Sign in to follow this  
Followers 0
DarkBoost

GUICtrlCreateCombo() - combining styles

3 posts in this topic

I love the default combo style that you can scroll through your list if it exceeds the height.

I also love the static text list which is the style I want to use but this does not allow you to scroll through the list if it exceeds the height.

So my post/question is can I combine Style A and B = see example

#include <GUIConstantsEx.au3>
#include <ComboConstants.au3>
#include <StaticConstants.au3>

Global $list, $min = 32, $max = 1920, $step = 16

For $a = $min To $max Step $step
    If $a <> $max Then $list &= $a & "|"
    If $a =  $max Then $list &= $a
Next

GUICreate("ComboList", 300, 135)
GUISetFont(8, "", "", "verdana")

;Style A
    GUICtrlCreateCombo("", 10, 10, 80, 20)
    GUICtrlSetData(-1, $list, "1024")
    GUICtrlCreateLabel("Style A - default style", 100, 10, 190, 20, $SS_CENTERIMAGE)

;Style B
    GUICtrlCreateCombo("", 10, 50, 80, 20, $CBS_DROPDOWNLIST)
    GUICtrlSetData(-1, $list, "1024")
    GUICtrlCreateLabel("Style B - static text list", 100, 50, 190, 20, $SS_CENTERIMAGE)

;Divider
    GUICtrlCreateLabel("", 10, 85, 280, 1)
    GUICtrlSetBkColor(-1, 0xCCCCCC)

;Style C
    GUICtrlCreateCombo("", 10, 100, 80, 20) ;Combine Style A + B here!!!
    GUICtrlSetData(-1, $list, "1024")
    GUICtrlCreateLabel("Style C - Style A + B combined", 100, 100, 190, 20, $SS_CENTERIMAGE)

GUISetState()

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

Share this post


Link to post
Share on other sites



Look at the default styles, "$CBS_DROPDOWN, $CBS_AUTOHSCROLL, $WS_VSCROLL", could it be any of these? VSCROLL sounds interesting.

Try it:

#include <GUIConstantsEx.au3>
#include <ComboConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

Global $list, $min = 32, $max = 1920, $step = 16

For $a = $min To $max Step $step
    If $a <> $max Then $list &= $a & "|"
    If $a =  $max Then $list &= $a
Next

GUICreate("ComboList", 300, 135)
GUISetFont(8, "", "", "verdana")

;Style A
    GUICtrlCreateCombo("", 10, 10, 80, 20)
    GUICtrlSetData(-1, $list, "1024")
    GUICtrlCreateLabel("Style A - default style", 100, 10, 190, 20, $SS_CENTERIMAGE)

;Style B
    GUICtrlCreateCombo("", 10, 50, 80, 20, $CBS_DROPDOWNLIST)
    GUICtrlSetData(-1, $list, "1024")
    GUICtrlCreateLabel("Style B - static text list", 100, 50, 190, 20, $SS_CENTERIMAGE)

;Divider
    GUICtrlCreateLabel("", 10, 85, 280, 1)
    GUICtrlSetBkColor(-1, 0xCCCCCC)

;Style C
    GUICtrlCreateCombo("", 10, 100, 80, 20, BitOR($WS_VSCROLL, $CBS_DROPDOWNLIST)) ;Combine Style A + B here!!!
    GUICtrlSetData(-1, $list, "1024")
    GUICtrlCreateLabel("Style C - Style A + B combined", 100, 100, 190, 20, $SS_CENTERIMAGE)

GUISetState()

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

Styles is combined with BitOR in case you didn't know.

There is a tutorial on setting styles here.

Share this post


Link to post
Share on other sites

argh... i keep forgetting that you can combine certain styles even when they are not listed under the specific functions advanced options. thanks!

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