Kloud Posted March 12, 2022 Posted March 12, 2022 If I use $WS_SYSMENU then for some reason the height of a combobox is no longer changed through _GUICtrlComboBox_SetItemHeight() here is an example script with both ways of creating the GUI: #include <GuiComboBox.au3> #include <GuiConstants.au3> ;$GUI_Main = GuiCreate("", 200, 200, -1, -1, BitOr($WS_SYSMENU, $WS_CAPTION)) $GUI_Main = GuiCreate("", 200, 200, -1, -1) $Combo_RTC = GUICtrlCreateCombo("", 48, 36, 80, 16, $CBS_DROPDOWNLIST) GUICtrlSetData(-1, "1 WEEK|2 WEEKS|4 WEEKS|8 WEEKS|3 MONTHS", "") _GUICtrlComboBox_SetItemHeight(-1, 29) _GUICtrlComboBox_SetItemHeight(-1, 12, 0) GUISetState() While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop Wend Exit I know that I should probably use _GUICtrlComboBox_Create() if I want to use _GUICtrlComboBox_SetItemHeight() but unfortunately I cannot hide a combobox created that way. Then again if I want to use the standard GUICtrlCreateCombo then the only way to change to height of the created combobox for me was to use _GUICtrlComboBox_SetItemHeight(). So I am kinda stuck here. Any help is appreciated!
Moderators Melba23 Posted March 12, 2022 Moderators Posted March 12, 2022 Kloud, Can you not just increase the font size? $Combo_RTC = GUICtrlCreateCombo("", 48, 36, 100, 16, $CBS_DROPDOWNLIST) GUICtrlSetData($Combo_RTC, "1 WEEK|2 WEEKS|4 WEEKS|8 WEEKS|3 MONTHS", "") GUICtrlSetFont($Combo_RTC, 14) M23 Kloud 1 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Solution ad777 Posted March 12, 2022 Solution Posted March 12, 2022 (edited) @Kloud you can use _GuiCtrlComboBox_Create() and you can hide it using:[ControlHide]: ControlHide($GUI_Main,"",$Combo_RTC) you say if you use $WS_SYSMENU then for some reason the height of a combobox is no longer changed,then you can use this trick: #include <GuiComboBox.au3> #include <GuiConstants.au3> $GUI_Main = GUICreate("", 200, 200, -1, -1) ;$GUI_Main = GuiCreate("", 200, 200, -1, -1) Local $Combo_RTC = GUICtrlCreateCombo("EE", 0, 0, 100, 100) GUICtrlSetData(-1, "1 WEEK|2 WEEKS|4 WEEKS|8 WEEKS|3 MONTHS", "") _GUICtrlComboBox_SetItemHeight($Combo_RTC, 29) _GUICtrlComboBox_SetItemHeight($Combo_RTC, 12, 0) GUISetState() GUISetStyle(BitOR($WS_SYSMENU, $WS_CAPTION),0,$GUI_Main) While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd Exit Edited March 12, 2022 by ad777 Kloud 1 none
Kloud Posted March 12, 2022 Author Posted March 12, 2022 2 hours ago, Melba23 said: Kloud, Can you not just increase the font size? $Combo_RTC = GUICtrlCreateCombo("", 48, 36, 100, 16, $CBS_DROPDOWNLIST) GUICtrlSetData($Combo_RTC, "1 WEEK|2 WEEKS|4 WEEKS|8 WEEKS|3 MONTHS", "") GUICtrlSetFont($Combo_RTC, 14) M23 Thanks for the feedback. Yes, in general that works: the input box of the combobox increses its height when the font size increases. But I just wanted to align the combobox borders with those of some labels and inputboxes so it would look a little weird if they would have different font sizes then.
Kloud Posted March 12, 2022 Author Posted March 12, 2022 (edited) 3 hours ago, ad777 said: @Kloud you can use _GuiCtrlComboBox_Create() and you can hide it using:[ControlHide]: ControlHide($GUI_Main,"",$Combo_RTC) you say if you use $WS_SYSMENU then for some reason the height of a combobox is no longer changed,then you can use this trick: #include <GuiComboBox.au3> #include <GuiConstants.au3> $GUI_Main = GUICreate("", 200, 200, -1, -1) ;$GUI_Main = GuiCreate("", 200, 200, -1, -1) Local $Combo_RTC = GUICtrlCreateCombo("EE", 0, 0, 100, 100) GUICtrlSetData(-1, "1 WEEK|2 WEEKS|4 WEEKS|8 WEEKS|3 MONTHS", "") _GUICtrlComboBox_SetItemHeight($Combo_RTC, 29) _GUICtrlComboBox_SetItemHeight($Combo_RTC, 12, 0) GUISetState() GUISetStyle(BitOR($WS_SYSMENU, $WS_CAPTION),0,$GUI_Main) While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd Exit Yes! Thank you. ControlHide() works. Your workaround is also working for me, thanks again. I also then added $WS_MINIMIZEBOX and $WS_POPUP which resultet in the input box of the combobox to resize to the default height once minimized and again restored. #include <GuiComboBox.au3> #include <GuiConstants.au3> $GUI_Main = GUICreate("", 200, 200, -1, -1) ;Local $Combo_RTC = _GUICtrlComboBox_Create($GUI_Main, "EE", 0, 0, 100, 100) Local $Combo_RTC = GUICtrlCreateCombo("EE", 0, 0, 100, 100) GUICtrlSetData(-1, "1 WEEK|2 WEEKS|4 WEEKS|8 WEEKS|3 MONTHS", "") _GUICtrlComboBox_SetItemHeight($Combo_RTC, 29) _GUICtrlComboBox_SetItemHeight($Combo_RTC, 12, 0) GUISetState() GUISetStyle(BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU ),0,$GUI_Main) ; Make control invisible ;ControlHide($GUI_Main,"",$Combo_RTC) While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd That doesn't happen if _GUICtrlComboBox_Create() is used though: #include <GuiComboBox.au3> #include <GuiConstants.au3> $GUI_Main = GUICreate("", 200, 200, -1, -1) Local $Combo_RTC = _GUICtrlComboBox_Create($GUI_Main, "EE", 0, 0, 100, 100) ;Local $Combo_RTC = GUICtrlCreateCombo("EE", 0, 0, 100, 100) ;GUICtrlSetData(-1, "1 WEEK|2 WEEKS|4 WEEKS|8 WEEKS|3 MONTHS", "") _GUICtrlComboBox_SetItemHeight($Combo_RTC, 29) _GUICtrlComboBox_SetItemHeight($Combo_RTC, 12, 0) GUISetState() GUISetStyle(BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU ),0,$GUI_Main) ; Make control invisible ;ControlHide($GUI_Main,"",$Combo_RTC) While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd So I guess one has to choose what fits here best. Thanks again! Related topic: https://www.autoitscript.com/forum/topic/102817-combobox-height-not-retained-after-minimize/ Edited March 12, 2022 by Kloud
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now