Jump to content

Combobox height cannot be changed if $WS_SYSMENU is used


Go to solution Solved by ad777,

Recommended Posts

Posted

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
Posted

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

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

 

  • Solution
Posted (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 by ad777

none

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

Posted (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 by Kloud

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...