Sign in to follow this  
Followers 0
midiaxe

Combo Box with no Edit

6 posts in this topic

#1 ·  Posted (edited)

Hello everybody,

I have a GUI and I need to create a combo box with the edit disable. I looked at the GUI doc and did not find any style definition for this. Am I missing something?

Appreciate the help!

Thanks,

=MX=

Edited by midiaxe

Share this post


Link to post
Share on other sites



It is in the help file.

CBS_DROPDOWNLIST            0x0003            Displays a static text field that displays the current selection in the list box.

Share this post


Link to post
Share on other sites

I tried the following code below and it seems that the listbox is still editable. I'm using the latest unstable version:

Thanks!

#include <GUIConstants.au3>

$wndMain = GUICreate("My GUI")

$cboBuildFile = GUICtrlCreateCombo("item1", 10, 10, 200, $CBS_DROPDOWNLIST)
GUICtrlSetData($cboBuildFile,"item2|item3","item3") 
GuiSetState(@SW_SHOW)

;-------------------------------
; Just idle around
While 1
  $msg = GUIGetMsg()
  If $msg = $GUI_EVENT_CLOSE Then   ExitLoop
Wend

Share this post


Link to post
Share on other sites

Of course it is. You're passing the style parameter as the height of the control.

Share this post


Link to post
Share on other sites

Or 'Read-Only' you said?

Here a small example:

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

GUICreate("test", 200, 100)

$combo=GUICtrlCreateCombo("", 10, 10, 100, 80, BitOR($ES_READONLY, $CBS_DROPDOWNLIST, $LBS_STANDARD))
GUICtrlSetData($combo,"item1|item2|item3", "item1")
GUISetState()

While 1
   $msg= GUIGetMsg()
  
   If $msg = $GUI_EVENT_CLOSE Then Exit
  
Wend
Exit

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Blame my fat finger I guess :) . Thanks Valik for spotting that error. Josbe, thanks for code, it really helped me. I've been debugging my code since last night and can't figure it out until I saw your code. I didnt know that you can use some style definitions from a control to another control (in this case an edit style, to a combo style).

Thanks,

-MX-

Edited by midiaxe

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