Jump to content

Combo Box Query


wzingel
 Share

Recommended Posts

I'm new to the GUI functions... but like them!

I would like to create a COMBO box but want to take away the ability to type in the box, only pick from the list. Been looking for a while, and can't figure it out.

Any help?

$StartDay=GUISetControl("Combo","",150,10,100,80)
   GUISetControlData($StartDay,"Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday","Monday")

Cheers

Link to comment
Share on other sites

Ok, you need add to your COMBOBOX: $ES_READONLY + $CBS_DROPDOWNLIST values(constants).

Look the small example...

Global $CBS_DROPDOWNLIST= 3
Global $ES_READONLY= 2048
Global $LBS_STANDARD= 10485763

$myWin= "ComboTest"
GUICreate($myWin, 200, 100)
$StartDay=GUISetControl("Combo","", 10, 10, 100, 80, $ES_READONLY + $CBS_DROPDOWNLIST   + $LBS_STANDARD)
GUISetControlData($StartDay,"Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday|jhj2|5|4|dsdsds|dsdsd", "Monday")
GUIShow()

While WinExists($myWin)
   Sleep(100)
   
   $msg= GUIMsg(0)
   
   If $msg = -3 Then Exit
   
Wend
Exit

EDIT: Script edited

Edited by josbe
Link to comment
Share on other sites

Cheers Valik, I have tried that style, and it does make the combo box one that can't be typed in, but the drop down list loses it's scrollbar. I _could_ extend the size of the drop down to see all the options, but I wondered if you can keep the scroll bar AND have the box so it can't be typed in?

Edited by wzingel
Link to comment
Share on other sites

Cheers Guys... great stuff...

josbe, added that in and it works a treat, but how did you work out what numbers you are assigning to these variables?

josbe & Valik, I had been looking at the GUI Control Styles in the help, and BITOR'ing the values together, but don't really understand how to work these things out for myself.

Any explaination would be great! Meanwhile, I'll continue to play... seems to be the best way to learn! :ph34r:

Thanks both

Warren

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...