Jump to content

How to make a combobox NO INTEGRAL HEIGHT?


chenxu
 Share

Recommended Posts

I knew that the UDF _GUICtrlComboBox_Create can do this. But I got an application which has been finished creating a combobox by using the GUICtrlCreateCombo function, and I do not want to rewrite the application.

Every time I change the size of the application, I need to change the height of the combobox created by GUICtrlCreateCombo, and the combobox will automaticly make itself integral height. How to stop the combobox automaticly making itself integral height?

Link to comment
Share on other sites

I knew that the UDF _GUICtrlComboBox_Create can do this. But I got an application which has been finished creating a combobox by using the GUICtrlCreateCombo function, and I do not want to rewrite the application.

Every time I change the size of the application, I need to change the height of the combobox created by GUICtrlCreateCombo, and the combobox will automaticly make itself integral height. How to stop the combobox automaticly making itself integral height?

I don't know the definition of "integral height". >_<

Perhaps all you need are some Global variables or math expressions for the position and size of the control, so it is adjusted automatically whenever you change the GUI size in the code?

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

I knew that the UDF _GUICtrlComboBox_Create can do this. But I got an application which has been finished creating a combobox by using the GUICtrlCreateCombo function, and I do not want to rewrite the application.

Every time I change the size of the application, I need to change the height of the combobox created by GUICtrlCreateCombo, and the combobox will automaticly make itself integral height. How to stop the combobox automaticly making itself integral height?

The height of a combobox is set by the font although the width can be changed. Here is a demo using a version of my recent post in gui help & support.

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global Const $WS_EX_COMPOSITED = 0x2000000
Global Const $WMSZ_BOTTOM = 6
Global Const $WMSZ_BOTTOMLEFT = 7
Global Const $WMSZ_BOTTOMRIGHT = 8
Global Const $WMSZ_LEFT = 1
Global Const $WMSZ_RIGHT = 2
Global Const $WMSZ_TOP = 3
Global Const $WMSZ_TOPLEFT = 4
Global Const $WMSZ_TOPRIGHT = 5
Opt("GUIResizeMode", $GUI_DOCKAUTO)
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 422, 237, 193, 125, BitOR($WS_MINIMIZEBOX, $WS_SIZEBOX, $WS_THICKFRAME, $WS_SYSMENU, $WS_CAPTION, $WS_POPUP, $WS_POPUPWINDOW, $WS_GROUP, $WS_BORDER, $WS_CLIPSIBLINGS), $WS_EX_COMPOSITED)
$Edit1 = GUICtrlCreateEdit("Line 1" & @CRLF & "line 2", 56, 24, 345, 145)
$Button1 = GUICtrlCreateCombo("jhgjghjhg",112, 200, 75, 25)
;GUICtrlCreateButton("Button1", 112, 200, 75, 25, 0)
$startBtnFontSize = 8
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
$gp = WinGetPos($Form1)
Global $HtoW = $gp[3] / $gp[2]
$stGui = WinGetClientSize($Form1)
GUIRegisterMsg($WM_SIZE, "SetFontSizes")
GUIRegisterMsg($WM_SIZING, "SetAspect")

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd


Func SetFontSizes()
    $newgui = WinGetClientSize($Form1)
    GUICtrlSetFont($Button1, $startBtnFontSize * $newgui[1] / $stGui[1])
    GUICtrlSetFont($Edit1, $startBtnFontSize * $newgui[1] / $stGui[1])
EndFunc ;==>SetFontSizes

Func SetAspect($hWnd, $iMsg, $wparam, $lparam)
    Local $sRect = DllStructCreate("Int[4]", $lparam)
    Local $left = DllStructGetData($sRect, 1, 1)
    Local $top = DllStructGetData($sRect, 1, 2)
    Local $Right = DllStructGetData($sRect, 1, 3)
    Local $bottom = DllStructGetData($sRect, 1, 4)
    
    Switch $wparam;drag side or corner
        Case $WMSZ_LEFT, $WMSZ_RIGHT
            $newHt = ($Right - $left) * $HtoW
            DllStructSetData($sRect, 1, DllStructGetData($sRect, 1, 2) + $newHt, 4)
        Case Else
            $newWid = ($bottom - $top) / $HtoW
            DllStructSetData($sRect, 1, DllStructGetData($sRect, 1, 1) + $newWid, 3)
    EndSwitch
    
    

;Return 1
EndFunc ;==>SetAspect
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
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...