Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Controls
  New Posts New Posts RSS Feed - Another ComboBox Markup Issue
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Another ComboBox Markup Issue

 Post Reply Post Reply
Author
Message
ScottW View Drop Down
Groupie
Groupie


Joined: 02 August 2005
Status: Offline
Points: 82
Post Options Post Options   Thanks (0) Thanks(0)   Quote ScottW Quote  Post ReplyReply Direct Link To This Post Topic: Another ComboBox Markup Issue
    Posted: 04 February 2009 at 10:54am
I can send an actual sample project if necessary, but to replicate this, just create a form with an ImageManager control and a ComboBox with DropdownList style. Add a single Icon to the ImageManager with ID 101. It should be a 16x16 icon. Then paste in this code and run. In the dropdown, it all looks great, but the selected item has the text clipped at the bottom. I tried using VerticalAlignment tag to bring the text up, but it doesn't seem to do anything. How can I fix this?

Private Sub Form_Load()

    SuiteControlsGlobalSettings.Icons.AddIcons ImageManager1.Icons

    With ComboBox1
        .EnableMarkup = True
   
        .AddItem "<TextBlock><Image Width='16' Height='16' Source='101' />Item 1</TextBlock>"
        .AddItem "<TextBlock><Image Width='16' Height='16' Source='101' />Item 2</TextBlock>"
        .AddItem "<TextBlock><Image Width='16' Height='16' Source='101' />Item 3</TextBlock>"
       
        .ListIndex = 0
    End With

End Sub

Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 04 February 2009 at 1:51pm
Hi,
try to move Image from TextBlock:
 
 .AddItem "<StackPanel Orientation="Hirizontal"><Image Width='16' Height='16' Source='101'/><TextBlock>Item 1</TextBlock></StackPanel>"
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
jpbro View Drop Down
Senior Member
Senior Member
Avatar

Joined: 12 January 2007
Status: Offline
Points: 1354
Post Options Post Options   Thanks (0) Thanks(0)   Quote jpbro Quote  Post ReplyReply Direct Link To This Post Posted: 04 February 2009 at 2:07pm
I think that this happens because the ComboBox height is locked to the font height, regardless of the markup size (try changing the height of the combobox and you'll see that it always snaps back to a certain size). You can workaround this by setting the font size of the ComboBox to something larger than you are using for your markup text, and then explicitly declare you TextBox font size as the smaller font size that you actually want...

For example:


    SuiteControlsGlobalSettings.Icons.AddIcons ImageManager1.Icons



    With ComboBox1
        .EnableMarkup = True
        .Font.Size = 12
  
        .AddItem "<TextBlock FontSize='8pt' VerticalAlignment='Center'><Image Width='16' Height='16' Source='101' /><Run BaselineAlignment='Center'>Item 1</Run></TextBlock>"
        .AddItem "<TextBlock FontSize='8pt' VerticalAlignment='Center'><Image Width='16' Height='16' Source='101' /><Run BaselineAlignment='Center'>Item 2</Run></TextBlock>"
        .AddItem "<TextBlock FontSize='8pt' VerticalAlignment='Center'><Image Width='16' Height='16' Source='101' /><Run BaselineAlignment='Center'>Item 3</Run></TextBlock>"
      
        .ListIndex = 0
    End With


Note that I've also added the Run tag with a center Baseline alignment to keep the text aligned nicely with the image.
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3

Language: Visual Basic 6.0 SP6

Back to Top
jpbro View Drop Down
Senior Member
Senior Member
Avatar

Joined: 12 January 2007
Status: Offline
Points: 1354
Post Options Post Options   Thanks (0) Thanks(0)   Quote jpbro Quote  Post ReplyReply Direct Link To This Post Posted: 04 February 2009 at 2:09pm
Or Oleg's method seems to work ;)

Just change "Hirizontal" to "Horizontal"
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3

Language: Visual Basic 6.0 SP6

Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 05 February 2009 at 6:08am

:)

Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.125 seconds.