Sign in to follow this  
Followers 0
wzingel

Combo Box Query

8 posts in this topic

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

Share this post


Link to post
Share on other sites



The style is called CBS_DROPDOWNLIST, but I don't know if it's in GuiConstants or what it's defined as. It causes the edit control to be replaced by a label.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

josbe, also cheers, just checked that out, but same thing occurs, I lose the scroll bar... any ideas?

Edited by wzingel

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

josbe, also cheers, just checked that out, but same thing occurs, I lose the scroll bar... any ideas?

<{POST_SNAPBACK}>

uppps!! :(

Add this, too:

Global $LBS_STANDARD= 10485763

:ph34r:

Edited by josbe

Share this post


Link to post
Share on other sites

You are overriding the default styles. You'll have to explicitly add all the styles you want, including WS_VSCROLL and any others you wish to have.

Share this post


Link to post
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

Share this post


Link to post
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
Sign in to follow this  
Followers 0