![]() |
[SOLVED] Multi Column Combobox? |
Post Reply ![]() |
Author | |
Xander75 ![]() Senior Member ![]() ![]() Joined: 26 April 2007 Status: Offline Points: 353 |
![]() ![]() ![]() ![]() ![]() Posted: 11 August 2010 at 4:43am |
Hi,
I have had a look into the Codejock Controls and I am aware that the combobox does not support multiple columns ![]() This has always been a major issue with Visual Basic 6, I am aware however that using the "Microsoft Forms 2.0 Obkect Library" does allow this functionality however when used in combination with the Codejock SkinFrameWork the control does not skin! Is there anyway of having a multiple column combobox in Visual Basic 6 that is skins correctly? If not, then I think this is a major must have to be added to the Codejock Combobox control. |
|
Product: Xtreme SuitePro (ActiveX) v15.3.1
Platform: Windows 7 64-bit (SP1) Professional Edition Languages: C#.Net using Visual Studio 2012 & Visual Basic 6.0 (SP6) |
|
![]() |
|
jpbro ![]() Senior Member ![]() ![]() Joined: 12 January 2007 Status: Offline Points: 1354 |
![]() ![]() ![]() ![]() ![]() |
If you just need a drop-down list style combobox, then you can achieve a multi-column display using Markup.
Try this with a CJ ComboBox on a form:
This will give you a 2 column combobox. You use AddItem as you normally would to populate the list, and then use the MarkupList property to add your 2 column markup for each item. |
|
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3 Language: Visual Basic 6.0 SP6 |
|
![]() |
|
Xander75 ![]() Senior Member ![]() ![]() Joined: 26 April 2007 Status: Offline Points: 353 |
![]() ![]() ![]() ![]() ![]() |
Thanks for that jpbro!!!
It's so simple to use from your demo code. Can I ask one other question, do you know how to change the dropdown list width automatically to the longest row in the list? I can manually manipulate the width using the DropDownWidth method but it would be nice to have this autosize the list width if possible. If not it's no big loss as the multiple column was what I was really looking for. |
|
Product: Xtreme SuitePro (ActiveX) v15.3.1
Platform: Windows 7 64-bit (SP1) Professional Edition Languages: C#.Net using Visual Studio 2012 & Visual Basic 6.0 (SP6) |
|
![]() |
|
jpbro ![]() Senior Member ![]() ![]() Joined: 12 January 2007 Status: Offline Points: 1354 |
![]() ![]() ![]() ![]() ![]() |
Glad to help. Unfortunately, I'm not aware of a way to determine the width of the longest row. One thing you could do, is set the width of the grid to the width of the ComboBox less the button/scrollbar width, and then set the TextWrapping property of your TextBlocks to Wrap.
This would all of the text in the drop-down list portion (and it would fit to the combobox width). The only drawback is that you would only see the first line of the text in the edit portion of the combobox. Try this:
In that sample, I use a fixed 24px to account for the button/vertical scrollbar, but you should use GetSystemMetrics API to get the actual value. I also used * for the width of the last column to tell it to use the available remaining width for that column. TextWrapping='Wrap' wraps the text at the cell edge. |
|
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3 Language: Visual Basic 6.0 SP6 |
|
![]() |
|
Xander75 ![]() Senior Member ![]() ![]() Joined: 26 April 2007 Status: Offline Points: 353 |
![]() ![]() ![]() ![]() ![]() |
Hi,
Thanks again for the info, I will check it out however I am just glad that the CJ Combo can display multiple columns. I have tried the following code as a requirement of my projects is to use several Combo's as filters. But instead of loading the text directly I need to do this on focus of the control as for example in the screenshot I have attached I would require to filter down the Products based on the selected Brand. However the following code fails to display the dropdown list. Any ideas?
![]() |
|
Product: Xtreme SuitePro (ActiveX) v15.3.1
Platform: Windows 7 64-bit (SP1) Professional Edition Languages: C#.Net using Visual Studio 2012 & Visual Basic 6.0 (SP6) |
|
![]() |
|
Xander75 ![]() Senior Member ![]() ![]() Joined: 26 April 2007 Status: Offline Points: 353 |
![]() ![]() ![]() ![]() ![]() |
Hi,
I have resolved the dropdown list issue, it was caused with setting both the EnableMarkup and DroppedState to true in the GotFocus event. Setting the combo to EnableMarkup in the form load event resolved the issue.
|
|
Product: Xtreme SuitePro (ActiveX) v15.3.1
Platform: Windows 7 64-bit (SP1) Professional Edition Languages: C#.Net using Visual Studio 2012 & Visual Basic 6.0 (SP6) |
|
![]() |
Post Reply ![]() |
|
Tweet
|
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |