Jump to content

GUICtrlSetPos and ControlGetPos ... checker


Recommended Posts

HI,

Please, are there some special reasons to explain why the 2 commands "GUICtrlSetPos and ControlGetPos" :

- do not return the same height value when applied for a control's type = "List"

- do not have the same command name prefix : "GUICtrlSetPos and GUICtrlGetPos" or "ControlSetPos and ControlGetPos" (which seems to hide important things).

I have written a small script to check the controls position when the GUI's dimensions are updated by the user (read "purpose comments" at the beginning of this script).

I have  discovered that for the "LIST" control type (GUICtrlCretaeList), the measure of heights are not correct (even with a "pixel ruler" !).

Is somebody able to explain me why ? , if I have written something wrong or if my script logic is false !

Thanks for your help.

Alain.

The Script :

#NoTrayIcon
#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <WinAPI.au3>

#include <StaticConstants.au3>
#include <ListBoxConstants.au3>
#cs
    2016/08/22 : From Grosminet (A.A.)

    The purpose of this script is to verify the position settings for different control when the Application's window size
    is updated by the user.
    See below for arrays containing --> $aGUI_LineCTRL_?
    S - Style values to apply to the control
    eS - Extended Style values
    ID - control ID returned using the "GUICtrlCreatexxx" control builder
    T - Type of the control
    W - Percentage of the client area width to be applied to the control (any % value)
    H - Percentage of the client area height to be applied to the control (Sum of % should be less or equal to 100% !)

    ANOMALIES :
    2 traces are done using the Console:
        From the "_UpdateGUI()" function, which use the "GUICtrlSetPos" command to set the new current control position after Application's window size update done by the user
        From the "_DumpCurrentGUI()" function, which use the "ControlGetPos" command to dump the current control position
    ==> Comparing the "WIDTH" values: no problem -> same values found
    ==> Comparing the "HEIGHT" values: !!! ANOMALIES !!! -> not the same values, and not the same diferences for the 2 controls and during different Application's window size updates.

#ce
; ************************************************************
Global $GUILinesNB = 2 ; ex. 2 'lines' of control (2 stages !)
Global $GUICtrlNB = 2 ; total nb of controls
Global $aGUI_LineCTRL_S[$GUILinesNB][2] = [[1, $LBS_SORT], [1, $LBS_SORT]] ; Initial control's Style inside line
Global $aGUI_LineCTRL_eS[$GUILinesNB][2] = [[1, -1], [1, -1]] ; Initial control's exStyle inside line
Global $aGUI_LineCTRL_ID[$GUILinesNB][2] ; Control's ID
Global $aGUI_LineCTRL_T[$GUILinesNB][2] = [[1, "List"], [1, "List"]] ; Control's Type
Global $aGUI_LineCTRL_W[$GUILinesNB][2] = [[1, 100], [1, 50]] ; Initial Width % of ctrls inside line
Global $aGUI_LineCTRL_H[$GUILinesNB][2] = [[1, 50], [1, 50]] ; Initial Height % inside line - (Sum of % should be less or equal to 100% !)

; ************************************************************
Global $iParentGUI
Global $iList1
Global $iList2
Global $space = 10, $count = 0
; ************************************************************
$iParentGUI = GUICreate('Control settings checker', 600, 500, -1, -1, BitOR($WS_MAXIMIZEBOX, $WS_MINIMIZEBOX, $WS_SYSMENU, $WS_SIZEBOX, $WS_CAPTION), BitOR($WS_EX_STATICEDGE,$WS_EX_WINDOWEDGE))
;
$iList1 = GUICtrlCreateList("Line 1 - control 1 : LIST", 0, 0, -1, -1, _
        $aGUI_LineCTRL_S[0][1], _
        $aGUI_LineCTRL_eS[0][1])
$aGUI_LineCTRL_ID[0][1] = $iList1
;
$iList2 = GUICtrlCreateList("Line 2 - control 1 : LIST", 0, 0, -1, -1, _
        $aGUI_LineCTRL_S[1][1], _
        $aGUI_LineCTRL_eS[1][1])
$aGUI_LineCTRL_ID[1][1] = $iList2
;
;
; ************************************************************
GUISetState(@SW_SHOW)
GUIRegisterMsg($WM_SIZE, "_WM_SIZE")

local $aGUIInfo = WinGetClientSize($iParentGUI)
_ResetGUI($iParentGUI, $aGUIInfo[0], $aGUIInfo[1])

Local $nMsg
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            ExitLoop
    EndSwitch
WEnd
; ************************************************************

Func _WM_SIZE($hWnd, $iMsg, $iwParam, $ilParam)
    Local Const $SIZE_MINIMIZED = 1 ; see MSDN -> https://msdn.microsoft.com/en-us/library/windows/desktop/ms632646(v=vs.85).aspx
    Switch $hWnd
        case $iParentGUI
            if $iwParam = $SIZE_MINIMIZED then Return $GUI_RUNDEFMSG
            Local $aClientSize[2] = [BitAND($ilParam, 65535), BitShift($ilParam, 16)]
            _ResetGUI($hWnd, $aClientSize[0], $aClientSize[1])
            Return 0 ; If an application processes this message, it should return zero.
        case else
            Return $GUI_RUNDEFMSG ; don't forget that return value to avoid strange _ArrayDisplay view (and more ...) !
    EndSwitch
EndFunc ; _WM_SIZE

Func _ResetGUI($hWnd, $ClientW_Width, $ClientW_Heigth)
    consolewriteDebug(1, @ScriptLineNumber, $count & " _ResetGUI()", " ------------------ ClientW-ClientH -> " & $ClientW_Width & "-" & $ClientW_Heigth &  " -----------------------------------------------" & @crlf)
    $count += 1
    GUISetState(@SW_LOCK, $hWnd)
    ;
    _UpdateGUI($hWnd, $ClientW_Width, $ClientW_Heigth)
    ;
    GUISetState(@SW_UNLOCK, $hWnd)
    _WinAPI_RedrawWindow($hWnd, 0, 0, $RDW_UPDATENOW + $RDW_INVALIDATE + $RDW_ALLCHILDREN)
    _DumpCurrentGUI($ClientW_Width, $ClientW_Heigth)
    ;
EndFunc ; _ResetGUI

Func _DumpCurrentGUI($iGUI_W, $iGUI_H)
    Local $leftX = 0
    Local $TopY = 0
    Local $WidthCTRL = 0
    Local $HeightCTRL = 0
    Local $aPos
    ;
    ; //////////////////
    ;
    consolewriteDebug(1, @ScriptLineNumber, "> _DumpCurrentGUI()",  " ->> ControlGetPos <<-" & @crlf)
    ;
    for $i = 0 to $GUILinesNB - 1 ; number of lines of controls with the same 'TOP' reference
        for $j = 1 to $aGUI_LineCTRL_S[$i][0] ; for each controls inside a line
            $aPos = ControlGetPos($iParentGUI, "", $aGUI_LineCTRL_ID[$i][$j])
            $leftX = $aPos[0]
            $TopY = $aPos[1]
            $WidthCTRL = $aPos[2]
            $HeightCTRL = $aPos[3]
            consolewriteDebug(1, @ScriptLineNumber, "> ", "Line : " & $i+1 & " ==> (type)-> X-Y-W-H = (" & $aGUI_LineCTRL_T[$i][$j] & ")-" & $leftX & "-" & $TopY & "-" & $WidthCTRL & " (" & $aGUI_LineCTRL_W[$i][$j] & ") -" & $HeightCTRL & " (" & $aGUI_LineCTRL_H[$i][$j] & ")" & @crlf)
        next
        consolewriteDebug(1, @ScriptLineNumber, "> ", "*********************************" & @crlf)
    next
EndFunc ; _DumpCurrentGUI

Func _UpdateGUI($hWnd, $iGUI_W, $iGUI_H)
    Local $leftX = $space
    Local $TopY = $space
    Local $MaxH = 0
    Local $WidthCTRL = 0
    Local $HeightCTRL = 0
    Local $percent = 0
    Local $ci
    local $currentH
    local $swarning
    local $aPos
    ;
    ; //////////////////
    ;
    consolewriteDebug(1, @ScriptLineNumber, "+ _UpdateGUI()", " ->> GUICtrlSetPos <<-" & @crlf)
    Local $WPercent = ($iGUI_W - (2) * $space) ; to keep at least a "space" border on left and on right
    Local $Hpercent = ($iGUI_H - ($GUILinesNB + 1) * $space) ; to keep at least a "space" border on top, on bottom and between the controls

    ;
    for $i = 0 to $GUILinesNB - 1 ; number of lines of controls
        ;
        ; ***
        ;
        for $j = 1 to $aGUI_LineCTRL_S[$i][0] ; for each controls inside a line
            ;
            ; Handle Width
            ;
            $percent = Number($aGUI_LineCTRL_W[$i][$j]) / 100
            $WidthCTRL = Floor($percent * $WPercent)
            ;
            ; Handle Height
            ;
            $percent = Number($aGUI_LineCTRL_H[$i][$j]) / 100
            $HeightCTRL = Floor($percent * $Hpercent)
            ;
            ; Move the control
            ;
            consolewriteDebug(1, @ScriptLineNumber, "+ ", "Line : " & $i+1 & " ==> (type)-> X-Y-W-H = (" & $aGUI_LineCTRL_T[$i][$j] & ")-" & $leftX & "-" & $TopY & "-" & $WidthCTRL & " (" & $aGUI_LineCTRL_W[$i][$j] & ") -" & $HeightCTRL & " (" & $aGUI_LineCTRL_H[$i][$j] & ")" & @crlf)
            ;
            GUICtrlSetPos($aGUI_LineCTRL_ID[$i][$j], _
                $leftX, _
                $TopY, _
                $WidthCTRL, _
                $HeightCTRL)
            ;
            ; Prepare next control inside the same line
            ;
            $leftX += $WidthCTRL + $space
        next
        ;
        ; Prepare next line of controls
        ;
        $TopY += $HeightCTRL + $space
        $leftX = $space
        consolewriteDebug(1, @ScriptLineNumber, "+ ", "*********************************" & @crlf)
    next
EndFunc ; _UpdateGUI

Func ConsoleWriteDebug($Debug, $lineNB, $flag, $msg)
    if $Debug then
        consolewrite($flag & "SLN: " & $lineNB & " - ")
        consolewrite($msg)
    endif
EndFunc ; ConsoleWriteDebug

 Some console outputs : compare in X-Y-W-H values the H results !

0 _ResetGUI()SLN: 89 -  ------------------ ClientW-ClientH -> 598-498 -----------------------------------------------
+ _UpdateGUI()SLN: 139 -  ->> GUICtrlSetPos <<-
+ SLN: 162 - Line : 1 ==> (type)-> X-Y-W-H = (List)-10-10-578 (100) -234 (50)
+ SLN: 179 - *********************************
+ SLN: 162 - Line : 2 ==> (type)-> X-Y-W-H = (List)-10-254-289 (50) -234 (50)
+ SLN: 179 - *********************************
> _DumpCurrentGUI()SLN: 110 -  ->> ControlGetPos <<-
> SLN: 119 - Line : 1 ==> (type)-> X-Y-W-H = (List)-10-10-578 (100) -228 (50)
> SLN: 121 - *********************************
> SLN: 119 - Line : 2 ==> (type)-> X-Y-W-H = (List)-10-254-289 (50) -228 (50)
> SLN: 121 - *********************************
1 _ResetGUI()SLN: 89 -  ------------------ ClientW-ClientH -> 869-498 -----------------------------------------------
+ _UpdateGUI()SLN: 139 -  ->> GUICtrlSetPos <<-
+ SLN: 162 - Line : 1 ==> (type)-> X-Y-W-H = (List)-10-10-849 (100) -234 (50)
+ SLN: 179 - *********************************
+ SLN: 162 - Line : 2 ==> (type)-> X-Y-W-H = (List)-10-254-424 (50) -234 (50)
+ SLN: 179 - *********************************
> _DumpCurrentGUI()SLN: 110 -  ->> ControlGetPos <<-
> SLN: 119 - Line : 1 ==> (type)-> X-Y-W-H = (List)-10-10-849 (100) -228 (50)
> SLN: 121 - *********************************
> SLN: 119 - Line : 2 ==> (type)-> X-Y-W-H = (List)-10-254-424 (50) -228 (50)
> SLN: 121 - *********************************
2 _ResetGUI()SLN: 89 -  ------------------ ClientW-ClientH -> 869-762 -----------------------------------------------
+ _UpdateGUI()SLN: 139 -  ->> GUICtrlSetPos <<-
+ SLN: 162 - Line : 1 ==> (type)-> X-Y-W-H = (List)-10-10-849 (100) -366 (50)
+ SLN: 179 - *********************************
+ SLN: 162 - Line : 2 ==> (type)-> X-Y-W-H = (List)-10-386-424 (50) -366 (50)
+ SLN: 179 - *********************************
> _DumpCurrentGUI()SLN: 110 -  ->> ControlGetPos <<-
> SLN: 119 - Line : 1 ==> (type)-> X-Y-W-H = (List)-10-10-849 (100) -356 (50)
> SLN: 121 - *********************************
> SLN: 119 - Line : 2 ==> (type)-> X-Y-W-H = (List)-10-386-424 (50) -356 (50)
> SLN: 121 - *********************************
3 _ResetGUI()SLN: 89 -  ------------------ ClientW-ClientH -> 869-317 -----------------------------------------------
+ _UpdateGUI()SLN: 139 -  ->> GUICtrlSetPos <<-
+ SLN: 162 - Line : 1 ==> (type)-> X-Y-W-H = (List)-10-10-849 (100) -143 (50)
+ SLN: 179 - *********************************
+ SLN: 162 - Line : 2 ==> (type)-> X-Y-W-H = (List)-10-163-424 (50) -143 (50)
+ SLN: 179 - *********************************
> _DumpCurrentGUI()SLN: 110 -  ->> ControlGetPos <<-
> SLN: 119 - Line : 1 ==> (type)-> X-Y-W-H = (List)-10-10-849 (100) -132 (50)
> SLN: 121 - *********************************
> SLN: 119 - Line : 2 ==> (type)-> X-Y-W-H = (List)-10-163-424 (50) -132 (50)
> SLN: 121 - *********************************

 

list_control_size.au3

Link to comment
Share on other sites

  • Moderators

Grosminet,

The 2 types of commands do not have the same "prefix" as they are used differently:

  • Any command that begins GUICtrl* is to be used on an AutoIt GUI created by the script itself - hence the use of a ControlID only to identify the control to be actioned.
  • Commands that begin Control* can be used on any GUI - hence the requirement to define the GUI by title and text as well as providing a ControlID.

This explains why there are both ControlGetPos & ControlMove - as you do not necessarily know the initial position of the control - while GUICtrlSetPos is alone, because you created the control and are supposed to know where it is now!

As to the differing list heights you detect, I believe there must be a problem with your maths because I do not see a difference when I run this similar script regardless of the method I use to reposition the lists:

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

$hGUI = GUICreate("Test", 500, 500  , Default, Default, $WS_SIZEBOX)

$aListSize = _CalcHeight()

$cList1 = GUICtrlCreateList("List 1", 10, 10, $aListSize[0], $aListSize[1])
$cList2 = GUICtrlCreateList("List 2", 10, $aListSize[1] + 20, $aListSize[0] / 2, $aListSize[1])

GUISetState()

GUIRegisterMsg($WM_SIZE, "_WM_SIZE")

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch

WEnd

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

    $aListSize = _CalcHeight()

    ;GUICtrlSetPos($cList1, 10, 10, $aListSize[0], $aListSize[1])
    ;GUICtrlSetPos($cList2, 10, $aListSize[1] + 20, $aListSize[0] / 2, $aListSize[1])

    ControlMove($hGUI, "", $cList1, 10, 10, $aListSize[0], $aListSize[1])
    ControlMove($hGUI, "", $cList2, 10, $aListSize[1] + 20, $aListSize[0] / 2, $aListSize[1])

    $aSize1 = ControlGetPos($hGUI, "", $cList1)
    $aSize2 = ControlGetPos($hGUI, "", $cList2)
    If $aSize1[3] <> $aSize2[3] Then
        ConsoleWrite("Lists NOT same height: " & $aSize1[3] & " - " & $aSize2[3] & @CRLF)
    EndIf

EndFunc

Func _CalcHeight()

    $aSize = WinGetClientSize($hGUI)
    $iWidthMargins = 20 ; 10 top and bottom
    $iHeightMargins = 30 ; 10 top, middle and bottom
    $aSize[0] = Floor($aSize[0] - $iWidthMargins)
    $aSize[1] = Floor(($aSize[1] - $iHeightMargins) / 2)
    Return $aSize

EndFunc

I do, however, see a slight difference in the actual positions of the controls, so I am investigating further.

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

 

Link to comment
Share on other sites

Thanks Melba for your help.

Please have a look on your updated script: i added just 2 'consolewrite' commands to focus on my problem !

I'm running Autoit 3.3.14.2 on Windows 7 / 7601.

Thanks,

Alain.

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

$hGUI = GUICreate("Test", 500, 500  , Default, Default, $WS_SIZEBOX)

$aListSize = _CalcHeight()

$cList1 = GUICtrlCreateList("List 1", 10, 10, $aListSize[0], $aListSize[1])
$cList2 = GUICtrlCreateList("List 2", 10, $aListSize[1] + 20, $aListSize[0] / 2, $aListSize[1])

GUISetState()

GUIRegisterMsg($WM_SIZE, "_WM_SIZE")

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch

WEnd

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

    $aListSize = _CalcHeight()

    ;GUICtrlSetPos($cList1, 10, 10, $aListSize[0], $aListSize[1])
    ;GUICtrlSetPos($cList2, 10, $aListSize[1] + 20, $aListSize[0] / 2, $aListSize[1])

    ControlMove($hGUI, "", $cList1, 10, 10, $aListSize[0], $aListSize[1])
    ControlMove($hGUI, "", $cList2, 10, $aListSize[1] + 20, $aListSize[0] / 2, $aListSize[1])

    ConsoleWrite("! Height allocated by the 'ControlMove' command: " & $aListSize[1] & @crlf)

    $aSize1 = ControlGetPos($hGUI, "", $cList1)
    $aSize2 = ControlGetPos($hGUI, "", $cList2)
    If $aSize1[3] <> $aSize2[3] Then
        ConsoleWrite("Lists NOT same height: " & $aSize1[3] & " - " & $aSize2[3] & @CRLF)
    EndIf
    ConsoleWrite("! Height read by the 'ControlGetPos' command: " & $aSize1[3] & @crlf)
EndFunc

Func _CalcHeight()

    $aSize = WinGetClientSize($hGUI)
    $iWidthMargins = 20 ; 10 top and bottom
    $iHeightMargins = 30 ; 10 top, middle and bottom
    $aSize[0] = Floor($aSize[0] - $iWidthMargins)
    $aSize[1] = Floor(($aSize[1] - $iHeightMargins) / 2)
    Return $aSize

EndFunc

 

Link to comment
Share on other sites

  • Moderators

Grosminet,

I had already noticed that - this is the "slight difference in the actual positions" I mentioned above and as stated I am trying to find out why this happens.

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

 

Link to comment
Share on other sites

  • Moderators

Grosminet,

I think I have it - it seems that you can only resize ListBoxes  to exact multiple line heights. Thus if the requested height is slightly more than a multiple of the line height, the control is actually set to a slightly reduced height. This script shows that the height value always has the same decimal element (no doubt the borders) while the integer part increases linearly - you can also see that there are always an exact number of lines displayed in the ListBox:

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

$hGUI = GUICreate("Test", 500, 500  , Default, Default, $WS_SIZEBOX)

$aListSize = _CalcHeight()

$cList1 = GUICtrlCreateList("List 1 - 0", 10, 10, $aListSize[0], $aListSize[1])
For $i = 1 To 50
    _GUICtrlListBox_AddString($cList1, "List1 - " & $i)
Next

$cList2 = GUICtrlCreateList("List 2", 10, $aListSize[1] + 20, $aListSize[0] / 2, $aListSize[1])

GUISetState()

$iLineheight = _GUICtrlListBox_GetItemHeight($cList1)
ConsoleWrite($iLineheight & @CRLF)

GUIRegisterMsg($WM_SIZE, "_WM_SIZE")

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch

WEnd

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

    $aListSize = _CalcHeight()

    ;GUICtrlSetPos($cList1, 10, 10, $aListSize[0], $aListSize[1])
    ;GUICtrlSetPos($cList2, 10, $aListSize[1] + 20, $aListSize[0] / 2, $aListSize[1])

    ControlMove($hGUI, "", $cList1, 10, 10, $aListSize[0], $aListSize[1])
    ControlMove($hGUI, "", $cList2, 10, $aListSize[1] + 20, $aListSize[0] / 2, $aListSize[1])

    ConsoleWrite("! Height allocated by the 'ControlMove' command: " & $aListSize[1] & @CRLF)

    $aSize1 = ControlGetPos($hGUI, "", $cList1)
    $aSize2 = ControlGetPos($hGUI, "", $cList2)
    If $aSize1[3] <> $aSize2[3] Then
        ConsoleWrite("Lists NOT same height: " & $aSize1[3] & " - " & $aSize2[3] & @CRLF)
    EndIf
    ConsoleWrite("+ Height read by the 'ControlGetPos' command: " & $aSize1[3] & @CRLF)
    ConsoleWrite("Lines: " & $aSize1[3] / $iLineheight & @CRLF)
EndFunc

Func _CalcHeight()

    $aSize = WinGetClientSize($hGUI)
    $iWidthMargins = 20 ; 10 top and bottom
    $iHeightMargins = 30 ; 10 top, middle and bottom
    $aSize[0] = Floor($aSize[0] - $iWidthMargins)
    $aSize[1] = Floor(($aSize[1] - $iHeightMargins) / 2)
    Return $aSize

EndFunc

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

 

Link to comment
Share on other sites

  • Moderators

Grosminet,

And this property can be removed by setting the $LBS_NOINTEGRALHEIGHT style when creating the ListBox.

I think that clears up everything satisfactorily.

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

 

Link to comment
Share on other sites

:)  Yes, yes, yes, thank you so much for this subtle explanation, I think you've hit on the right reason for what happens ! and I guess the same behaviour should apply for other controls like 'ListView', TreeView, ...

Anyway, I'll take this information into account to continue my development.
I think we can now close this post..
Thank you - Alain.

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