zone97

[SOLVED] Resize Columns when Resizing GUI

9 posts in this topic

#1 ·  Posted (edited)

Say I have this.... I have all the controls locked down to where they need to be, but Id like the column headers to all stay the same with the exception of just Number? I want it to resize when the list does.. OR.. All of them resize equally. .Whichever is easiest to do..

#Region ### START Koda GUI section ### Form=
$Form1_1 = GUICreate($guititle, 405, 325, -1, -1, $WS_SIZEBOX)
GUISetBkColor(0xC0C0C0)
$List1 = GUICtrlCreateListView("Call #|Number|Date|Length|Inbound|Missed", 7, 28, 390, 162, $LVS_SINGLESEL)
GUICtrlSetResizing(-1, $GUI_DOCKTOP + $GUI_DOCKBOTTOM + $GUI_DOCKHCENTER + $GUI_DOCKLEFT + $GUI_DOCKRIGHT)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 50)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 50)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 2, 50)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 3, 50)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 4, 50)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 5, 50)
$Button1 = GUICtrlCreateButton("Call Back", 160, 205, 85, 25)
GUICtrlSetResizing(-1, $GUI_DOCKBOTTOM + $GUI_DOCKHCENTER + $GUI_DOCKSIZE)
$Checkbox1 = GUICtrlCreateCheckbox("Always On Top", 154, 5, 97, 17)
GUICtrlSetResizing(-1, $GUI_DOCKTOP + $GUI_DOCKHCENTER + $GUI_DOCKSIZE)
$Group1 = GUICtrlCreateGroup("This Month", 6, 198, 90, 97)
$Label1 = GUICtrlCreateLabel("Inbound:", 15, 218, 43, 17)
$Label2 = GUICtrlCreateLabel("Outbound:", 15, 243, 51, 17)
$Label3 = GUICtrlCreateLabel("Missed:", 15, 268, 37, 17)
$Label4 = GUICtrlCreateLabel("0", 69, 217, 20, 17)
$Label5 = GUICtrlCreateLabel("0", 69, 242, 20, 17)
$Label6 = GUICtrlCreateLabel("0", 69, 267, 20, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUICtrlSetResizing($Group1, $GUI_DOCKBOTTOM + $GUI_DOCKSIZE + $GUI_DOCKLEFT)
GUICtrlSetResizing($Label1, $GUI_DOCKBOTTOM + $GUI_DOCKSIZE + $GUI_DOCKLEFT)
GUICtrlSetResizing($Label2, $GUI_DOCKBOTTOM + $GUI_DOCKSIZE + $GUI_DOCKLEFT)
GUICtrlSetResizing($Label3, $GUI_DOCKBOTTOM + $GUI_DOCKSIZE + $GUI_DOCKLEFT)
GUICtrlSetResizing($Label4, $GUI_DOCKBOTTOM + $GUI_DOCKSIZE + $GUI_DOCKLEFT)
GUICtrlSetResizing($Label5, $GUI_DOCKBOTTOM + $GUI_DOCKSIZE + $GUI_DOCKLEFT)
GUICtrlSetResizing($Label6, $GUI_DOCKBOTTOM + $GUI_DOCKSIZE + $GUI_DOCKLEFT)
$Group2 = GUICtrlCreateGroup("Today", 307, 198, 90, 97)
$Label7 = GUICtrlCreateLabel("Inbound:", 316, 218, 43, 17)
$Label8 = GUICtrlCreateLabel("Outbound:", 316, 243, 51, 17)
$Label9 = GUICtrlCreateLabel("Missed:", 316, 268, 37, 17)
$Label10 = GUICtrlCreateLabel("0", 370, 217, 20, 17)
$Label11 = GUICtrlCreateLabel("0", 370, 242, 20, 17)
$Label12 = GUICtrlCreateLabel("0", 370, 267, 20, 17)
GUICtrlSetResizing($Group2, $GUI_DOCKBOTTOM + $GUI_DOCKSIZE + $GUI_DOCKRIGHT)
GUICtrlSetResizing($Label7, $GUI_DOCKBOTTOM + $GUI_DOCKSIZE + $GUI_DOCKRIGHT)
GUICtrlSetResizing($Label8, $GUI_DOCKBOTTOM + $GUI_DOCKSIZE + $GUI_DOCKRIGHT)
GUICtrlSetResizing($Label9, $GUI_DOCKBOTTOM + $GUI_DOCKSIZE + $GUI_DOCKRIGHT)
GUICtrlSetResizing($Label10, $GUI_DOCKBOTTOM + $GUI_DOCKSIZE + $GUI_DOCKRIGHT)
GUICtrlSetResizing($Label11, $GUI_DOCKBOTTOM + $GUI_DOCKSIZE + $GUI_DOCKRIGHT)
GUICtrlSetResizing($Label12, $GUI_DOCKBOTTOM + $GUI_DOCKSIZE + $GUI_DOCKRIGHT)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

 

Edited by zone97

 

Spoiler

WinSizer 2.1 (01/04/2017) - Download - [ Windows Layout Manager ]
Folder+Program (12/23/2016) - Download - [ USB Shortcut Creator ]

 

Share this post


Link to post
Share on other sites



zone97,

Here you go:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiListView.au3>

$Form1_1 = GUICreate("", 405, 325, -1, -1, $WS_SIZEBOX)
GUISetBkColor(0xC0C0C0)
$List1 = GUICtrlCreateListView("Call #|Number|Date|Length|Inbound|Missed", 7, 28, 390, 162, $LVS_SINGLESEL)
GUICtrlSetResizing(-1, $GUI_DOCKTOP + $GUI_DOCKBOTTOM + $GUI_DOCKHCENTER)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 50)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 50)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 2, 50)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 3, 50)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 4, 50)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 5, 50)
$Button1 = GUICtrlCreateButton("Call Back", 160, 205, 85, 25)
GUICtrlSetResizing(-1, $GUI_DOCKBOTTOM + $GUI_DOCKHCENTER + $GUI_DOCKSIZE)
$Checkbox1 = GUICtrlCreateCheckbox("Always On Top", 154, 5, 97, 17)
GUICtrlSetResizing(-1, $GUI_DOCKTOP + $GUI_DOCKHCENTER + $GUI_DOCKSIZE)
$Group1 = GUICtrlCreateGroup("This Month", 6, 198, 90, 97)
$Label1 = GUICtrlCreateLabel("Inbound:", 15, 218, 43, 17)
$Label2 = GUICtrlCreateLabel("Outbound:", 15, 243, 51, 17)
$Label3 = GUICtrlCreateLabel("Missed:", 15, 268, 37, 17)
$Label4 = GUICtrlCreateLabel("0", 69, 217, 20, 17)
$Label5 = GUICtrlCreateLabel("0", 69, 242, 20, 17)
$Label6 = GUICtrlCreateLabel("0", 69, 267, 20, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUICtrlSetResizing($Group1, $GUI_DOCKBOTTOM + $GUI_DOCKSIZE + $GUI_DOCKLEFT)
GUICtrlSetResizing($Label1, $GUI_DOCKBOTTOM + $GUI_DOCKSIZE + $GUI_DOCKLEFT)
GUICtrlSetResizing($Label2, $GUI_DOCKBOTTOM + $GUI_DOCKSIZE + $GUI_DOCKLEFT)
GUICtrlSetResizing($Label3, $GUI_DOCKBOTTOM + $GUI_DOCKSIZE + $GUI_DOCKLEFT)
GUICtrlSetResizing($Label4, $GUI_DOCKBOTTOM + $GUI_DOCKSIZE + $GUI_DOCKLEFT)
GUICtrlSetResizing($Label5, $GUI_DOCKBOTTOM + $GUI_DOCKSIZE + $GUI_DOCKLEFT)
GUICtrlSetResizing($Label6, $GUI_DOCKBOTTOM + $GUI_DOCKSIZE + $GUI_DOCKLEFT)
$Group2 = GUICtrlCreateGroup("Today", 307, 198, 90, 97)
$Label7 = GUICtrlCreateLabel("Inbound:", 316, 218, 43, 17)
$Label8 = GUICtrlCreateLabel("Outbound:", 316, 243, 51, 17)
$Label9 = GUICtrlCreateLabel("Missed:", 316, 268, 37, 17)
$Label10 = GUICtrlCreateLabel("0", 370, 217, 20, 17)
$Label11 = GUICtrlCreateLabel("0", 370, 242, 20, 17)
$Label12 = GUICtrlCreateLabel("0", 370, 267, 20, 17)
GUICtrlSetResizing($Group2, $GUI_DOCKBOTTOM + $GUI_DOCKSIZE + $GUI_DOCKRIGHT)
GUICtrlSetResizing($Label7, $GUI_DOCKBOTTOM + $GUI_DOCKSIZE + $GUI_DOCKRIGHT)
GUICtrlSetResizing($Label8, $GUI_DOCKBOTTOM + $GUI_DOCKSIZE + $GUI_DOCKRIGHT)
GUICtrlSetResizing($Label9, $GUI_DOCKBOTTOM + $GUI_DOCKSIZE + $GUI_DOCKRIGHT)
GUICtrlSetResizing($Label10, $GUI_DOCKBOTTOM + $GUI_DOCKSIZE + $GUI_DOCKRIGHT)
GUICtrlSetResizing($Label11, $GUI_DOCKBOTTOM + $GUI_DOCKSIZE + $GUI_DOCKRIGHT)
GUICtrlSetResizing($Label12, $GUI_DOCKBOTTOM + $GUI_DOCKSIZE + $GUI_DOCKRIGHT)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)

GUIRegisterMsg($WM_SIZING, "_WM_SIZING")

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

Func _WM_SIZING($hWnd, $iMsg, $wParam, $lParam)

    #forceref $iMsg, $wParam, $lParam
    If $hWnd = $Form1_1 Then
        $aRet = ControlGetPos($Form1_1, "", $List1)
        _GUICtrlListView_SetColumnWidth($List1, 1, $aRet[2] - 340)
    EndIf

EndFunc

Please ask if you have any questions.

M23

1 person likes this

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites

Works.... But.... Lol, I have a minimum id like the cell to be, how would I specify not to go below when sizing?


 

Spoiler

WinSizer 2.1 (01/04/2017) - Download - [ Windows Layout Manager ]
Folder+Program (12/23/2016) - Download - [ USB Shortcut Creator ]

 

Share this post


Link to post
Share on other sites

zone97,

The first thing to do is specify the minimum size of the GUI itself - search for $WM_GETMINMAXINFO to learn how to do that. Then you just need some simple maths when doing the column width calculation inside the $WM_SIZING handler.

M23

1 person likes this

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

I simply changed

_GUICtrlListView_SetColumnWidth($List1, 1, $aRet[2] - 340)

to

_GUICtrlListView_SetColumnWidth($List1, 1, $aRet[2] - 306)

Seems to work. Again thank you very much for your assistance.

#Region ### START Koda GUI section ### Form=
$Form1_1 = GUICreate($guititle, 405, 325, -1, -1, $WS_SIZEBOX)
GUISetBkColor(0xC0C0C0)
$List1 = GUICtrlCreateListView("Call #|Number|Date|Length|Inbound|Missed", 7, 28, 390, 162, $LVS_SINGLESEL)
GUICtrlSetResizing(-1, $GUI_DOCKTOP + $GUI_DOCKBOTTOM + $GUI_DOCKHCENTER + $GUI_DOCKLEFT + $GUI_DOCKRIGHT)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 50)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 50)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 2, 50)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 3, 50)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 4, 50)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 5, 50)
$Button1 = GUICtrlCreateButton("Call Back", 160, 205, 85, 25)
GUICtrlSetResizing(-1, $GUI_DOCKBOTTOM + $GUI_DOCKHCENTER + $GUI_DOCKSIZE)
$Checkbox1 = GUICtrlCreateCheckbox("Always On Top", 154, 5, 97, 17)
GUICtrlSetResizing(-1, $GUI_DOCKTOP + $GUI_DOCKHCENTER + $GUI_DOCKSIZE)
$Group1 = GUICtrlCreateGroup("This Month", 6, 198, 90, 97)
$Label1 = GUICtrlCreateLabel("Inbound:", 15, 218, 43, 17)
$Label2 = GUICtrlCreateLabel("Outbound:", 15, 243, 51, 17)
$Label3 = GUICtrlCreateLabel("Missed:", 15, 268, 37, 17)
$Label4 = GUICtrlCreateLabel("0", 69, 217, 20, 17)
$Label5 = GUICtrlCreateLabel("0", 69, 242, 20, 17)
$Label6 = GUICtrlCreateLabel("0", 69, 267, 20, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUICtrlSetResizing($Group1, $GUI_DOCKBOTTOM + $GUI_DOCKSIZE + $GUI_DOCKLEFT)
GUICtrlSetResizing($Label1, $GUI_DOCKBOTTOM + $GUI_DOCKSIZE + $GUI_DOCKLEFT)
GUICtrlSetResizing($Label2, $GUI_DOCKBOTTOM + $GUI_DOCKSIZE + $GUI_DOCKLEFT)
GUICtrlSetResizing($Label3, $GUI_DOCKBOTTOM + $GUI_DOCKSIZE + $GUI_DOCKLEFT)
GUICtrlSetResizing($Label4, $GUI_DOCKBOTTOM + $GUI_DOCKSIZE + $GUI_DOCKLEFT)
GUICtrlSetResizing($Label5, $GUI_DOCKBOTTOM + $GUI_DOCKSIZE + $GUI_DOCKLEFT)
GUICtrlSetResizing($Label6, $GUI_DOCKBOTTOM + $GUI_DOCKSIZE + $GUI_DOCKLEFT)
$Group2 = GUICtrlCreateGroup("Today", 307, 198, 90, 97)
$Label7 = GUICtrlCreateLabel("Inbound:", 316, 218, 43, 17)
$Label8 = GUICtrlCreateLabel("Outbound:", 316, 243, 51, 17)
$Label9 = GUICtrlCreateLabel("Missed:", 316, 268, 37, 17)
$Label10 = GUICtrlCreateLabel("0", 370, 217, 20, 17)
$Label11 = GUICtrlCreateLabel("0", 370, 242, 20, 17)
$Label12 = GUICtrlCreateLabel("0", 370, 267, 20, 17)
GUICtrlSetResizing($Group2, $GUI_DOCKBOTTOM + $GUI_DOCKSIZE + $GUI_DOCKRIGHT)
GUICtrlSetResizing($Label7, $GUI_DOCKBOTTOM + $GUI_DOCKSIZE + $GUI_DOCKRIGHT)
GUICtrlSetResizing($Label8, $GUI_DOCKBOTTOM + $GUI_DOCKSIZE + $GUI_DOCKRIGHT)
GUICtrlSetResizing($Label9, $GUI_DOCKBOTTOM + $GUI_DOCKSIZE + $GUI_DOCKRIGHT)
GUICtrlSetResizing($Label10, $GUI_DOCKBOTTOM + $GUI_DOCKSIZE + $GUI_DOCKRIGHT)
GUICtrlSetResizing($Label11, $GUI_DOCKBOTTOM + $GUI_DOCKSIZE + $GUI_DOCKRIGHT)
GUICtrlSetResizing($Label12, $GUI_DOCKBOTTOM + $GUI_DOCKSIZE + $GUI_DOCKRIGHT)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

initMinMax(419, 260, 900, 900)

GUICtrlSendMsg($List1, $LVM_SETCOLUMNWIDTH, 0, 50)
GUICtrlSendMsg($List1, $LVM_SETCOLUMNWIDTH, 1, 50)
GUICtrlSendMsg($List1, $LVM_SETCOLUMNWIDTH, 2, 50)
GUICtrlSendMsg($List1, $LVM_SETCOLUMNWIDTH, 3, 50)
GUICtrlSendMsg($List1, $LVM_SETCOLUMNWIDTH, 4, 60)
GUICtrlSendMsg($List1, $LVM_SETCOLUMNWIDTH, 5, 50)

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

Func initMinMax($x0, $y0, $x1, $y1)
    Local Const $WM_GETMINMAXINFO = 0x24
    $aUtil_MinMax[0] = $x0
    $aUtil_MinMax[1] = $y0
    $aUtil_MinMax[2] = $x1
    $aUtil_MinMax[3] = $y1
    GUIRegisterMsg($WM_GETMINMAXINFO, '_GetMinMaxInfo')
EndFunc   ;==>initMinMax

Func _GetMinMaxInfo($hWnd, $Msg, $wParam, $lParam)
    Local $minmaxinfo = DllStructCreate('int;int;int;int;int;int;int;int;int;int', $lParam)
    DllStructSetData($minmaxinfo, 7, $aUtil_MinMax[0]) ; min X
    DllStructSetData($minmaxinfo, 8, $aUtil_MinMax[1]) ; min Y
    DllStructSetData($minmaxinfo, 9, $aUtil_MinMax[2]) ; max X
    DllStructSetData($minmaxinfo, 10, $aUtil_MinMax[3]) ; max Y
    #forceref $Msg, $wParam, $lParam
    If $hWnd = $Form1_1 Then
        $aRet = ControlGetPos($Form1_1, "", $List1)
        _GUICtrlListView_SetColumnWidth($List1, 1, $aRet[2] - 306)
    EndIf
    Return $GUI_RUNDEFMSG
EndFunc   ;==>_GetMinMaxInfo

 

Edited by zone97

 

Spoiler

WinSizer 2.1 (01/04/2017) - Download - [ Windows Layout Manager ]
Folder+Program (12/23/2016) - Download - [ USB Shortcut Creator ]

 

Share this post


Link to post
Share on other sites

zone97,

My pleasure, as always.

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

In case anyone wanted it.. I solved how to proportionally resize the headings.

$aPart = ($aRet[2] - 120) / 4 ; - Set the outside headers to static, devide over all by remaining, subtract static. and adjusted.
        _GUICtrlListView_SetColumnWidth($List1, 0, 50)
        _GUICtrlListView_SetColumnWidth($List1, 1, $aPart + 17)
        _GUICtrlListView_SetColumnWidth($List1, 2, $aPart + 3)
        _GUICtrlListView_SetColumnWidth($List1, 3, $aPart - 10)
        _GUICtrlListView_SetColumnWidth($List1, 4, $aPart - 11)
        _GUICtrlListView_SetColumnWidth($List1, 5, 50)

 

Edited by zone97

 

Spoiler

WinSizer 2.1 (01/04/2017) - Download - [ Windows Layout Manager ]
Folder+Program (12/23/2016) - Download - [ USB Shortcut Creator ]

 

Share this post


Link to post
Share on other sites

Now that all this has been sorted manually. What can I do about using WinMove? When I store the GUI location and recall it. Then move and resize. The outer GUI is the correct size, but none of the controls resize as they do when you drag the GUI edge? Am i missing a setting or option?


 

Spoiler

WinSizer 2.1 (01/04/2017) - Download - [ Windows Layout Manager ]
Folder+Program (12/23/2016) - Download - [ USB Shortcut Creator ]

 

Share this post


Link to post
Share on other sites

zone97,

You need to amend the ListView columns after the whole GUI has been resized - something like this:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiListView.au3>

Global  $aUtil_MinMax[4], $fResized = False

#Region ### START Koda GUI section ### Form=
$Form1_1 = GUICreate("Fred", 405, 325, -1, -1, $WS_SIZEBOX)
GUISetBkColor(0xC0C0C0)
$List1 = GUICtrlCreateListView("Call #|Number|Date|Length|Inbound|Missed", 7, 28, 390, 162, $LVS_SINGLESEL)
GUICtrlSetResizing(-1, $GUI_DOCKTOP + $GUI_DOCKBOTTOM + $GUI_DOCKHCENTER + $GUI_DOCKLEFT + $GUI_DOCKRIGHT)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 50)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 50)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 2, 50)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 3, 50)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 4, 50)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 5, 50)
$Button1 = GUICtrlCreateButton("WinMove", 160, 205, 85, 25)
GUICtrlSetResizing(-1, $GUI_DOCKBOTTOM + $GUI_DOCKHCENTER + $GUI_DOCKSIZE)
$Checkbox1 = GUICtrlCreateCheckbox("Always On Top", 154, 5, 97, 17)
GUICtrlSetResizing(-1, $GUI_DOCKTOP + $GUI_DOCKHCENTER + $GUI_DOCKSIZE)
$Group1 = GUICtrlCreateGroup("This Month", 6, 198, 90, 97)
$Label1 = GUICtrlCreateLabel("Inbound:", 15, 218, 43, 17)
$Label2 = GUICtrlCreateLabel("Outbound:", 15, 243, 51, 17)
$Label3 = GUICtrlCreateLabel("Missed:", 15, 268, 37, 17)
$Label4 = GUICtrlCreateLabel("0", 69, 217, 20, 17)
$Label5 = GUICtrlCreateLabel("0", 69, 242, 20, 17)
$Label6 = GUICtrlCreateLabel("0", 69, 267, 20, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUICtrlSetResizing($Group1, $GUI_DOCKBOTTOM + $GUI_DOCKSIZE + $GUI_DOCKLEFT)
GUICtrlSetResizing($Label1, $GUI_DOCKBOTTOM + $GUI_DOCKSIZE + $GUI_DOCKLEFT)
GUICtrlSetResizing($Label2, $GUI_DOCKBOTTOM + $GUI_DOCKSIZE + $GUI_DOCKLEFT)
GUICtrlSetResizing($Label3, $GUI_DOCKBOTTOM + $GUI_DOCKSIZE + $GUI_DOCKLEFT)
GUICtrlSetResizing($Label4, $GUI_DOCKBOTTOM + $GUI_DOCKSIZE + $GUI_DOCKLEFT)
GUICtrlSetResizing($Label5, $GUI_DOCKBOTTOM + $GUI_DOCKSIZE + $GUI_DOCKLEFT)
GUICtrlSetResizing($Label6, $GUI_DOCKBOTTOM + $GUI_DOCKSIZE + $GUI_DOCKLEFT)
$Group2 = GUICtrlCreateGroup("Today", 307, 198, 90, 97)
$Label7 = GUICtrlCreateLabel("Inbound:", 316, 218, 43, 17)
$Label8 = GUICtrlCreateLabel("Outbound:", 316, 243, 51, 17)
$Label9 = GUICtrlCreateLabel("Missed:", 316, 268, 37, 17)
$Label10 = GUICtrlCreateLabel("0", 370, 217, 20, 17)
$Label11 = GUICtrlCreateLabel("0", 370, 242, 20, 17)
$Label12 = GUICtrlCreateLabel("0", 370, 267, 20, 17)
GUICtrlSetResizing($Group2, $GUI_DOCKBOTTOM + $GUI_DOCKSIZE + $GUI_DOCKRIGHT)
GUICtrlSetResizing($Label7, $GUI_DOCKBOTTOM + $GUI_DOCKSIZE + $GUI_DOCKRIGHT)
GUICtrlSetResizing($Label8, $GUI_DOCKBOTTOM + $GUI_DOCKSIZE + $GUI_DOCKRIGHT)
GUICtrlSetResizing($Label9, $GUI_DOCKBOTTOM + $GUI_DOCKSIZE + $GUI_DOCKRIGHT)
GUICtrlSetResizing($Label10, $GUI_DOCKBOTTOM + $GUI_DOCKSIZE + $GUI_DOCKRIGHT)
GUICtrlSetResizing($Label11, $GUI_DOCKBOTTOM + $GUI_DOCKSIZE + $GUI_DOCKRIGHT)
GUICtrlSetResizing($Label12, $GUI_DOCKBOTTOM + $GUI_DOCKSIZE + $GUI_DOCKRIGHT)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

initMinMax(419, 260, 900, 900)

GUICtrlSendMsg($List1, $LVM_SETCOLUMNWIDTH, 0, 50)
GUICtrlSendMsg($List1, $LVM_SETCOLUMNWIDTH, 1, 50)
GUICtrlSendMsg($List1, $LVM_SETCOLUMNWIDTH, 2, 50)
GUICtrlSendMsg($List1, $LVM_SETCOLUMNWIDTH, 3, 50)
GUICtrlSendMsg($List1, $LVM_SETCOLUMNWIDTH, 4, 60)
GUICtrlSendMsg($List1, $LVM_SETCOLUMNWIDTH, 5, 50)

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            WinMove($Form1_1, "", 100, 100, 800, 500)
    EndSwitch

    If $fResized Then
        $fResized = False
        $aRet = ControlGetPos($Form1_1, "", $List1)
        _GUICtrlListView_SetColumnWidth($List1, 1, $aRet[2] - 340)
    EndIf

WEnd

Func initMinMax($x0, $y0, $x1, $y1)
    Local Const $WM_GETMINMAXINFO = 0x24
    $aUtil_MinMax[0] = $x0
    $aUtil_MinMax[1] = $y0
    $aUtil_MinMax[2] = $x1
    $aUtil_MinMax[3] = $y1
    GUIRegisterMsg($WM_GETMINMAXINFO, '_GetMinMaxInfo')
EndFunc   ;==>initMinMax

Func _GetMinMaxInfo($hWnd, $Msg, $wParam, $lParam)

    ConsoleWrite("Hit" & @CRLF)

    Local $minmaxinfo = DllStructCreate('int;int;int;int;int;int;int;int;int;int', $lParam)
    DllStructSetData($minmaxinfo, 7, $aUtil_MinMax[0]) ; min X
    DllStructSetData($minmaxinfo, 8, $aUtil_MinMax[1]) ; min Y
    DllStructSetData($minmaxinfo, 9, $aUtil_MinMax[2]) ; max X
    DllStructSetData($minmaxinfo, 10, $aUtil_MinMax[3]) ; max Y

    $fResized = True

    Return $GUI_RUNDEFMSG
EndFunc   ;==>_GetMinMaxInfo

Basically you cannot resize the ListView column inside the GetMaxMinInfo handler as when that fires, the GUI has not yet been resized.

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
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