Jump to content

Organizing a Combo Box


Ghost21
 Share

Recommended Posts

Is there a way to sort a combo box contents.. Via numbers or letters ???

Using the GUICtrlCreateCombo() "style" parameter, $CBS_SORT

- MoChr(77)& Chr(97)& Chr(100)& Chr(101)& Chr(32)& Chr(121)& Chr(97)& Chr(32)& Chr(108)& Chr(111)& Chr(111)& Chr(107)-------I've told you 100,000 times not to exaggerate!-------Don't make me hit you with my cigarette hand...-------My scripts:Random Episode Selector, Keyboard MouseMover, CopyPath v2.1, SmartRename for XP,Window Tracer[sup]New![/sup]

Link to comment
Share on other sites

I thought that worked only if its being typed in... Sorry should have been more specific. It's being queried from an SQL database and sent to it...

Should still work, I think.

Anyway, can't you add a Order By parameter to your sql SELECT query?

"There are 10 types of people in this world - those who can read binary, and those who can't.""We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true." ~Robert Wilensky0101101 1001010 1100001 1101101 1100101 1110011 0110011 1001101 10001110000101 0000111 0001000 0001110 0001101 0010010 1010110 0100001 1101110
Link to comment
Share on other sites

  • 1 year later...

hmmm.. I will have to look that up...Thanks for the tip..

I'm running into a similar situation. I'm using logparser to populate the combo box. I'm already using an Order By in the LogParser query, but it's case sensitive. The $CBS_SORT doesn't work. As stated before, that will only work for ones you type into the drop down.

Any other suggestions? I haven't been able to get Log Parser to be case insenstive when sorting.

Edited by Cyri
Link to comment
Share on other sites

  • Moderators

Hi,

Why not load the returned values into an array and then sort the array (_ArraySort). Getting the array into the combo is trivial:

For $i = 1 To $aList[0]
    $sList &= $aList[$i] & "|"
Next

$hCombo = GUICtrlCreateCombo (...)
GUICtrlSetData(-1, $sList, "")

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Hi,

Why not load the returned values into an array and then sort the array (_ArraySort). Getting the array into the combo is trivial:

For $i = 1 To $aList[0]
    $sList &= $aList[$i] & "|"
Next

$hCombo = GUICtrlCreateCombo (...)
GUICtrlSetData(-1, $sList, "")

M23

I was hoping to avoid that extra step, but that sounds like the way to go. Thanks.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...