Jump to content

GUI resizing problem


Zedna
 Share

Recommended Posts

I have GUI window with handled WM_GETMINMAXINFO and setup GUICtrlSetResizing() for controls.

It's working fine only one little problem:

I can't achieve to have constant space between ListView and StatusBar (label statusbar)

while resizing window.

Can somebody help me with this?

Here is my code:

#include <GUIConstants.au3>

Const $WM_GETMINMAXINFO = 0x24
Const $LVM_SETCOLUMNWIDTH = 0x101E

$Form1 = GUICreate("Test resize", 456, 521, -1, -1,BitOR($GUI_SS_DEFAULT_GUI,$WS_SIZEBOX))
$Label1 = GUICtrlCreateLabel("Label:", 119, 17, 43, 17, $SS_RIGHT)
GUICtrlSetResizing (-1,$GUI_DOCKTOP + $GUI_DOCKHEIGHT)
$cb_server = GUICtrlCreateCombo("Data", 166, 16, 145, 200, BitOR($CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL,$WS_VSCROLL))
GUICtrlSetResizing (-1,$GUI_DOCKTOP + $GUI_DOCKHEIGHT)
$ListView1 = GUICtrlCreateListView("Col1|Col2|Col3|Col4", 2, 56, 452, 443)
GUICtrlSetResizing (-1,$GUI_DOCKTOP)
GUICtrlSendMsg($ListView1, $LVM_SETCOLUMNWIDTH, 0, 100)
GUICtrlSendMsg($ListView1, $LVM_SETCOLUMNWIDTH, 1, 65)
GUICtrlSendMsg($ListView1, $LVM_SETCOLUMNWIDTH, 2, 165)
GUICtrlSendMsg($ListView1, $LVM_SETCOLUMNWIDTH, 3, 80)
$statusbar = GUICtrlCreateLabel("Number of records = 0", 2, 502, 452, 17, -1, $WS_EX_CLIENTEDGE)
GUICtrlSetResizing (-1,$GUI_DOCKBOTTOM + $GUI_DOCKHEIGHT)
GUISetState(@SW_SHOW)

Global $size = WinGetPos($Form1)
$size = $size[2] ; width of window (GUICreate is ClientSize)
GUIRegisterMsg($WM_GETMINMAXINFO, "MY_WM_GETMINMAXINFO")

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            Exit
    EndSelect
WEnd
Exit

; set min. and max. width to initial width, so it can be changed only height
Func MY_WM_GETMINMAXINFO($hWnd, $Msg, $wParam, $lParam)
    $minmaxinfo = DllStructCreate("int;int;int;int;int;int;int;int;int;int",$lParam)
    DllStructSetData($minmaxinfo,7,$size) ; min width
    DllStructSetData($minmaxinfo,9,$size) ; max width
    Return 0
EndFunc
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...