Jump to content

Combo-Box Problem


Recommended Posts

If that won't click within your head, probably nothing will:

#include <GuiConstantsEx.au3>

Opt("GuiOnEventMode", 1)

$hGUI = GUICreate("Test", 300, 100)
GUISetOnEvent($GUI_EVENT_CLOSE, "_Quit")

Local $a_ConnectionList[3] = ["Intel Copper Ethernet", "BroadCom Fibre", "VMware Network Adapter"]
$ge_Label_Connection = GUICtrlCreateLabel("Please select the NIC to use:", 16, 10, 200, 17)
$ge_Combo_Connection = GUICtrlCreateCombo($a_ConnectionList, 16, 30, 249, 300, 0x0003)
For $i = 0 To UBound($a_ConnectionList) - 1
    GUICtrlSetData($ge_Combo_Connection, $a_ConnectionList[$i], $a_ConnectionList[0])
Next

GUISetState()

While 1
    Sleep(10)
Wend

Func _Quit()
    Exit
EndFunc

The key to your wish is 0x0003. Next time 1st RTFM (helpfile, you may reach it by pressing F1 in SciTe) and 2nd post your code or nobody will help you.

Regards,

Chris

EDIT: BTW, above I yesterday wrote complete bullshit probably having my head somewhere else. The option "0x0003" is meant to make the values displayed by the combo read-only. But at the same time the option seems to limit the combo to 30 items max. So also for me the question arises how to force showing all items?

Edited by cherdeg
Link to comment
Share on other sites

  • Moderators

FSoft,

If I populate a combobox with 60 items, I get the first 30 displayed and a vertical scroll bar to move down to the next 30:

Global $sString = ""
For $i = 1 To 60
    $sString &= $i & "|"
Next

$hGUI = GUICreate("Test", 300, 100)

$hCombo = GUICtrlCreateCombo("", 16, 30, 249, 300)
    GUICtrlSetData($hCombo, $sString)

GUISetState()

While 1
    If GUIGetMsg() = -3 Then Exit
WEnd

Are you saying that you do not get a scroll bar? Are you sure you have all 60 items in the GUICtrlSetData?

As everyone else has asked - please post your code because lacking that vital element it is very difficult to do anything at all to help you. :-)

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

I didn't post the code because it is a simple GUI with 1 combo.

I discovered that the problem is the $CBS_DROPDOWNLIST style.

If I use that style, i see only the first 30 lines; if i don't use it i see all items with the scrollbar.

Link to comment
Share on other sites

I didn't post the code because it is a simple GUI with 1 combo.

I discovered that the problem is the $CBS_DROPDOWNLIST style.

If I use that style, i see only the first 30 lines; if i don't use it i see all items with the scrollbar.

Change your style entry to:

BitOR($CBS_DROPDOWNLIST,$WS_VSCROLL)

- 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

  • Moderators

FSoft,

The problem is not "the $CBS_DROPDOWNLIST style". The problem is you overwriting the default styles.

If you read the Help file you see that the default style settings are: "$CBS_DROPDOWN, $CBS_AUTOHSCROLL, $WS_VSCROLL". So if you set only $CBS_DROPDOWNLIST , you lose the 2 SCROLL styles.

As Monamo has pointed out, you need to reset the $WS_VSCROLL style together with $CBS_DROPDOWNLIST to regain your scrollbar.

This is true for all AutoIt controls - if you set any styles you must also reset any default styles that you need and have overwritten. As Valik is fond of saying (among other things!): "AutoIt cannot read your mind - you need to tell it what to do!"

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

FSoft,

The problem is not "the $CBS_DROPDOWNLIST style". The problem is you overwriting the default styles.

If you read the Help file you see that the default style settings are: "$CBS_DROPDOWN, $CBS_AUTOHSCROLL, $WS_VSCROLL". So if you set only $CBS_DROPDOWNLIST , you lose the 2 SCROLL styles.

As Monamo has pointed out, you need to reset the $WS_VSCROLL style together with $CBS_DROPDOWNLIST to regain your scrollbar.

This is true for all AutoIt controls - if you set any styles you must also reset any default styles that you need and have overwritten. As Valik is fond of saying (among other things!): "AutoIt cannot read your mind - you need to tell it what to do!"

M23

Thanks, it works...

P.S.: But who is Valik?

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