Hello folks,
I'm new and looking for indications that the things I'm used to in VB6 can be done in PureBasic. I've looked through the help files and I'm still in the dark.
** In gadgets like Combo Boxes and list boxes, can the displayed data be sorted (like setting a 'sorted' attribute in VB6) or does the data need to be 'fed in' from a pre-sorted list?
** In gadgets like Combo Boxes and list boxes, can columns be added that are not necessarily displayed but hold data to be used when a main column' item is selected?
** can a combo or list box have its HEIGHT changed, so that the list can be longer vertically, (subject to screen height)
** In gadgets like Combo Boxes and list boxes when populated, can a user press a keyboard letter, e.g. "R" or whatever, to jump directly to the first listed item that starts with an "R"?
Much obliged,
AL
Gadget Attributes Question
Re: Gadget Attributes Question
Yes to all. Pretty much anything VB6 can do, PureBasic can do. Maybe not as "simply", but doable. The benefits of PureBasic over VB6 make it worth it.

If you give a more specific example of what you're trying to achieve, someone will reply with a working example.
For the two questions above: yes. Here's an example code for ComboBoxes. It adds unsorted items alphabetically to a 50-pixel high ComboBox.aldewacs wrote:** In gadgets like Combo Boxes and list boxes, can the displayed data be sorted (like setting a 'sorted' attribute in VB6) or does the data need to be 'fed in' from a pre-sorted list?
** can a combo or list box have its HEIGHT changed, so that the list can be longer vertically, (subject to screen height)

Code: Select all
Dim text$(3)
text$(1)="m"
text$(2)="z"
text$(3)="a"
If OpenWindow(0, 200, 200, 270, 70, "ComboBoxGadget", #PB_Window_SystemMenu)
ComboBoxGadget(0, 10, 10, 250, 50, #CBS_SORT)
For n = 1 To 3
;AddGadgetItem(0, -1, text$(n)) ; Can't use due to the #CBS_SORT flag being specified.
SendMessage_(GadgetID(0), #CB_ADDSTRING, 0, text$(n)) ; So add alphabetically this way.
Next
SetGadgetState(0, 0)
SetActiveGadget(0)
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf
It kind-of works for ComboBoxes above, but only for the first keypress. You can do it for subsequent keypresses but I don't have the code to show right now.aldewacs wrote:** In gadgets like Combo Boxes and list boxes when populated, can a user press a keyboard letter, e.g. "R" or whatever, to jump directly to the first listed item that starts with an "R"?
For ListViews and ComboBoxes, this isn't possible (they don't support columns) so you'll need to store data another way, such as using the SetGadgetData() command with it. Alternatively, use a ListIcon (with its header removed) instead of ListView, so you can add extra columns with a 0-pixel width to "hide" the extra data columns for each added item. I do this for my own apps.aldewacs wrote:** In gadgets like Combo Boxes and list boxes, can columns be added that are not necessarily displayed but hold data to be used when a main column' item is selected?
If you give a more specific example of what you're trying to achieve, someone will reply with a working example.
Re: Gadget Attributes Question
See also SetGadgetItemData
There's an example of how to use it here; it's written for the ListIconGadget but the same principle applies to the gadgets you mention.
viewtopic.php?f=13&t=73803
There's an example of how to use it here; it's written for the ListIconGadget but the same principle applies to the gadgets you mention.
viewtopic.php?f=13&t=73803
Re: Gadget Attributes Question
BarryG and Spikey: thank you.
I guess I need more imagination, and also digging deeper.
I hope as I start to REALLY program rather than theorize, it'll all come together.
Your comments are encouraging.
AL
I guess I need more imagination, and also digging deeper.
I hope as I start to REALLY program rather than theorize, it'll all come together.
Your comments are encouraging.
AL