Jump to content

GUIFrame UDF - Melba23 version - 19 May 14


Melba23
 Share

Recommended Posts

Let me know what you think. ;)

M23

Great, Great, Great!

Now I think I've stumbled upon one more issue: $WS_TABSTOP doesn't seem to work.

EDIT:

there's one thing the makes a difference (still doesn't work though):

when creating the frame, if I put $WS_EX_CONTROLPARENT in the extended style, then tab works but in a different / wrong way - for example in an input box it selects the string entered (like coming again to the same input box instead of going to the next one).

So, maybe it's just some kind of an extended style I'm missing.

Edited by thewizard21
Link to comment
Share on other sites

  • Moderators

thewizard21,

Glad you like it. ;)

As to the $WS_TABSTOP problem, I imagine it is because AutoIt does not correctly handle the $WS_EX_CONTROLPARENT style as explained earlier in the thread. As I understand the $WS_EX_CONTROLPARENT style, it is that which allows controls on children to follow in the TABSTOP chain - as I cannot implement it, the TABSTOP chain cannot be established. So I regret to say that you are stuck with that problem - unless you want your users to be able to drag the frames around inside the GUI. :D

I will do some tidying and release a new version next week. :)

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 M23, for all the good work.

one, hopefully final, question:

do you have any incites as to why $WS_EX_ACCEPTFILES doesn't seem to work?

Edit:

after some testing, I think it's an off topic question - so forget about it...

Edit2:

just thought it would be better to put on note the glitch I had with dropped files:

initially $GUI_EVENT_DROPPED didn't seem to work - of course the problem was you have to set the event on the handle of the frame in which the ctrl element resides, for ex.:

GUISetOnEvent($GUI_EVENT_DROPPED, "GUIsystemEvent", _GUIFrame_GetHandle($FRAME, 1))
Edited by thewizard21
Link to comment
Share on other sites

  • Moderators

[NEW VERSION] - 24 Apr 12

Added 2 optional changes to the way the frames act when the surrounding GUI is changed in size:

1. Previously the frame minimum sizes set by _GUIFrame_SetMin were stored as a percentage of the initial GUI size - resizing the GUI changed the actual size of the minimum value to maintain the same percentage value. An additional parameter now allows you set an absolute value for these minima regardless of the size of the GUI. The top/left frame will always take priority if the GUI is reduced below the combined minimum sizes.

2. The separator bar did not move when the GUI was resized - you can now specify in the _GUIFrame_ResizeSet function whether either or neither frame should remain static when the GUI is resized.

These changes are not script-breaking as the new parameters are optional and the default behaviour of the UDF is very close to what you are used to seeing. Thanks to thewizard21 for asking for the new features. ;)

New UDF and a new example in the first post. :)

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

  • 1 year later...

Exactly what I need, thanks M23

Anyway, Are there any styles for separator bar? or hide it? I don't like the old look, just when mouse over it and cursor change to separator

$Money = ControlGetMoney(@Life,"People","Pocket4")If $Money Then $Rich = TrueElse $Risk = True _RunAwayFromPolice("Fastest")EndIf
Link to comment
Share on other sites

  • Moderators

DucViet321,

Glad you find it useful - even if you find it a bit "old-looking". It is probably taking after its author. :D

There are no styles for the separator bar, nor can you hide it - although you can reduce its size from the default 5 pixels by using the $iSepSize parameter in the _GUIFrame_Create function. I will take a look to see if I can do something along the lines you suggest, but I must warn you that it will not be very high on my list of priorities. ;)

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

DucViet321,

Delighted to hear it. :)

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

Everytime I move the speparator bar and my listview disappear?

Beside, I moved to windows 7 and speparator size back again, can't change the size?

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

$hGUI = GUICreate("test", 500, 500, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_MAXIMIZEBOX, $WS_SIZEBOX))
GUISetState()

; Create a 1st level frame
$iFrame_A = _GUIFrame_Create($hGUI,0,0,1)
_GUIFrame_SetMin($iFrame_A, 50, 100)
_GUIFrame_Switch($iFrame_A, 2)


; Create a 2nd level frame
$iFrame_B = _GUIFrame_Create($hGUI, 0,0,3)
_GUIFrame_SetMin($iFrame_B, 100, 100)

$cListView = GUICtrlCreateListView("", 5, 5, 240, 460)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 50)

; Set resizing flag for all created frames
_GUIFrame_ResizeSet(0)

; Register the $WM_SIZE handler to permit resizing
_GUIFrame_ResizeReg()

GUICtrlCreateListViewItem("item|123", $cListView)
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
$Money = ControlGetMoney(@Life,"People","Pocket4")If $Money Then $Rich = TrueElse $Risk = True _RunAwayFromPolice("Fastest")EndIf
Link to comment
Share on other sites

  • Moderators

DucViet321,

If you create subframes then you need to create them using the handle of the frame in which it will fit - you were using the main GUI and that will not work as it is already subdivided. :)

Checking in the UDF you can only set the separator width to between 3 and 9 pixels - outside that range will default to 5 pixels. I seem to remember that it was difficult to see the separator if you made it any smaller than 3 pixels wide. By all means change the relevant lines in the UDF of you want to experiment, but I will not offer support if you do. ;)

; Set separator size
Local $iSeparatorSize = 5
Switch $iSepSize
    Case 3 To 9 ; Just change these values <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
        $iSeparatorSize = $iSepSize
EndSwitch
Where do you want your ListView created? At present it will appear in the right-hand frame of the subframe as that is the last GUI created. In this script I have used the _GUIFrame_Switch function to set the active GUI to the left-hand frame of the main frame - is that what you intended? :huh:

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

$hGUI = GUICreate("test", 500, 500, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_MAXIMIZEBOX, $WS_SIZEBOX))
GUISetState()

; Create a 1st level frame
$iFrame_A = _GUIFrame_Create($hGUI, 0, 0, 5)
_GUIFrame_SetMin($iFrame_A, 50, 100)

; Create a 2nd level frame
$iFrame_B = _GUIFrame_Create(_GUIFrame_GetHandle($iFrame_A, 2), 0, 0, 5) ; You need to handle of the frame, not the GUI <<<<<<<<<<<<<<<<<<<
_GUIFrame_SetMin($iFrame_B, 100, 100)

_GUIFrame_Switch($iFrame_A, 1) ; Switch to the frame in which you want to create the ListView <<<<<<<<<<<<<<<<<<<<<<<<
$cListView = GUICtrlCreateListView(" | ", 5, 5, 240, 460)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 50)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 50) ; Set the width of both columns <<<<<<<<<<<<<<<

; Set resizing flag for all created frames
_GUIFrame_ResizeSet(0)

; Register the $WM_SIZE handler to permit resizing
_GUIFrame_ResizeReg()

GUICtrlCreateListViewItem("item|123", $cListView)

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd
All clear now? :)

 

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

  • 3 weeks later...
  • Moderators

AZJIO,

Where exactly in the code did you place those lines? I have tried in several locations and the cursor still flickers if I move it quickly. :huh:

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

AZJIO,

Thanks for that - much nicer looking. :thumbsup:

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

$hGUI = GUICreate("GUI_Frame Example 1", 500, 500, -1, -1, $WS_OVERLAPPEDWINDOW + $WS_POPUP)

$WS_OVERLAPPEDWINDOW + $WS_POPUP = The correct style window

Well-chosen styles create a window in which the size of the client area corresponds to the values specified in the parameters "width", "height". This should be in the help file.

Link to comment
Share on other sites

  • Moderators

AZJIO,

For a start it should be:

BitOR($WS_OVERLAPPEDWINDOW, $WS_POPUP)
as that is the correct way to combine styles. ;)

 

Secondly, I suggest you make this point in the Help file thread - I am sure I am not the only one who does not use your suggested styles when creating resizable GUIs. :)

 

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

  • 5 months later...

Hi, :bye:

Thank you Melba23 for this great UDF :thumbsup:

I am having some trouble with this UDF because I have a toolbar and a status bar in my GUI.

First, I can't get the frame to occupy only the space between the tool and status bars. Secondly, when resizing the GUI the frame overlaps and gets hidden behind the tool bar.

Also note that I read the solution you posted regarding status bars in frames and I tried applying it to my GUI but the example you posted didn't divide the main GUI so it's different and I am not sure if I need to make additional status bars in each frame.

Here is an example:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiToolbar.au3>
#include <GuiStatusbar.au3>
#include <GUIFrame.au3>

Global $hGUI_Main = GUICreate("Lyric Tag", 800, 600, -1, -1, BitOR($WS_OVERLAPPEDWINDOW, $WS_POPUP))
GUISetState()

; Main statusbar
;~ Global $hGUICtrl_Sbar = _GUICtrlStatusBar_Create($hGUI_Main)
;~ _GUICtrlStatusBar_SetMinHeight($hGUICtrl_Sbar, 20)

; ToolBar
Global $hGUICtrl_Tbar = _GUICtrlToolbar_Create($hGUI_Main)
_GUICtrlToolbar_AddBitmap($hGUICtrl_Tbar, 1, -1, $IDB_STD_LARGE_COLOR)
_GUICtrlToolbar_AddButton($hGUICtrl_Tbar, 1000, 0, _GUICtrlToolbar_AddString($hGUICtrl_Tbar, "&Cut"))
Global $iGUICtrl_TbarHeight = _GuiCtrlToolbar_GetHeight($hGUICtrl_Tbar)

; Create GUI Frame
Global $iFrameHeight = 600 - $iGUICtrl_TbarHeight - 0 - 2
Global $iFrame = _GUIFrame_Create($hGUI_Main, 0, 550, 6, 0, $iGUICtrl_TbarHeight + 1, 0, $iFrameHeight)

; Create listview in right frame
_GUIFrame_Switch($iFrame, 1)
; Testing status bar inside frame but does not show correctly
Global $hGUICtrl_Sbar = _GUICtrlStatusBar_Create(_GUIFrame_GetHandle($iFrame, 1))
_GUICtrlStatusBar_SetMinHeight($hGUICtrl_Sbar, 20)
; Listview
$aSize = WinGetClientSize(_GUIFrame_GetHandle($iFrame, 1))
Global $hGUICtrl_Listv = GUICtrlCreateListView("test", 0, 0, $aSize[0], $aSize[1])

GUISetState(@SW_SHOW, $hGUI_Main)
GUIRegisterMsg($WM_SIZE, "_WM_SIZE")

_GUIFrame_ResizeSet(0)

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            _GUICtrlStatusBar_Destroy($hGUICtrl_Sbar)
            _GUICtrlToolbar_Destroy($hGUICtrl_Tbar)
            Exit
    EndSwitch
WEnd

Func _GuiCtrlToolbar_GetHeight(ByRef $hTbar)
    If Not IsHWnd($hTbar) Then Return SetError(1, 0, 0)
    Local $aSize = _GUICtrlToolbar_GetMaxSize($hTbar)
    Local $aPadd = _GUICtrlToolbar_GetPadding($hTbar)
    Return $aSize[1] + $aPadd[1]
EndFunc   ;==>_GuiCtrlToolbar_GetHeight

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

    _GUIFrame_SIZE_Handler($hWnd, $iMsg, $wParam, $lParam)
    Local $aClientSize = WinGetClientSize($hGUI_Main)

    ; Resize toolbar & Resize Statusbar
    WinMove($hGUICtrl_Tbar, "", Default, Default, $aClientSize[0])
    _GUICtrlStatusBar_Resize($hGUICtrl_Sbar)
EndFunc   ;==>_WM_SIZE

Any help will be appreciated.

Link to comment
Share on other sites

  • Moderators

mvk25,

That as a fun morning! :D

I can fix the Toolbar problem by creating a horozontally-divided frame within the main GUI and setting the top part to be non-resizeable in height - then we put the toolbar into the top frame and fix the minimums so that the frame separator cannot move.

But the status bars are another problem altogether. Here are the best results I have come up with:

First, a status bar on the main GUI:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiToolbar.au3>
#include <GuiStatusbar.au3>
#include <GUIFrame.au3>

Global $hGUI_Main = GUICreate("Lyric Tag", 800, 600, Default, Default, $WS_SIZEBOX);, BitOR($WS_OVERLAPPEDWINDOW, $WS_POPUP))
GUISetState()

; Create main statusbar
$iMain_SBar_Height = 20
Global $hGUICtrl_Sbar_Main = _GUICtrlStatusBar_Create($hGUI_Main)
_GUICtrlStatusBar_SetMinHeight($hGUICtrl_Sbar_Main, $iMain_SBar_Height)
_GUICtrlStatusBar_SetText($hGUICtrl_Sbar_Main, "Main status bar")

; Create first frame
Global $iFrame_1 = _GUIFrame_Create($hGUI_Main, 1, 50) ;, $iMain_SBar_Height, 3)

; Get handle of top pane
$hTop_Pane = _GUIFrame_GetHandle($iFrame_1, 1)
GUISetBkColor(0xFFCCCC, $hTop_Pane)
$hBot_Pane = _GUIFrame_GetHandle($iFrame_1, 2)
GUISetBkColor(0xCCFFCC, $hBot_Pane)

; ToolBar
Global $hGUICtrl_Tbar = _GUICtrlToolbar_Create($hTop_Pane)
_GUICtrlToolbar_AddBitmap($hGUICtrl_Tbar, 1, -1, $IDB_STD_LARGE_COLOR)
_GUICtrlToolbar_AddButton($hGUICtrl_Tbar, 1000, 0, _GUICtrlToolbar_AddString($hGUICtrl_Tbar, "&Cut"))
Global $iGUICtrl_TbarHeight = _GuiCtrlToolbar_GetHeight($hGUICtrl_Tbar)

; Set separator bar and set min size
_GUIFrame_SetSepPos($iFrame_1, $iGUICtrl_TbarHeight)
$aClient = WinGetClientSize($hBot_Pane)
_GUIFrame_SetMin($iFrame_1, $iGUICtrl_TbarHeight, $aClient[1], True)

; Now create second level frame
$aClient = WinGetClientSize($hBot_Pane)
Global $iFrame_2 = _GUIFrame_Create($hBot_Pane, 0, 0, 5, 0, 0, 0, $aClient[1] - 25)

$hLeft_Pane = _GUIFrame_GetHandle($iFrame_2, 1)
GUISetBkColor(0xCCCCFF, $hLeft_Pane)

; Create label in right frame
_GUIFrame_Switch($iFrame_2, 1)
$aSize = WinGetClientSize($hLeft_Pane)
Global $cLabel = GUICtrlCreateLabel("", 10, 10, $aSize[0] - 20, $aSize[1] - 20)
GUICtrlSetBkColor($cLabel, 0xFFFFFF)

GUISetState(@SW_SHOW, $hGUI_Main)

GUIRegisterMsg($WM_SIZE, "_WM_SIZE")

_GUIFrame_ResizeSet($iFrame_1, 1) ; Fix top frame size
_GUIFrame_ResizeSet($iFrame_2) ; Allow bottom frame to resize

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            _GUICtrlStatusBar_Destroy($hGUICtrl_Sbar_Main)
            _GUICtrlToolbar_Destroy($hGUICtrl_Tbar)
            Exit
    EndSwitch
WEnd

Func _GuiCtrlToolbar_GetHeight(ByRef $hTbar)
    If Not IsHWnd($hTbar) Then Return SetError(1, 0, 0)
    Local $aSize = _GUICtrlToolbar_GetMaxSize($hTbar)
    Local $aPadd = _GUICtrlToolbar_GetPadding($hTbar)
    Return $aSize[1] + $aPadd[1]
EndFunc   ;==>_GuiCtrlToolbar_GetHeight

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

    _GUIFrame_SIZE_Handler($hWnd, $iMsg, $wParam, $lParam)
    Local $aClientSize = WinGetClientSize($hGUI_Main)

    ; Resize toolbar & Resize Statusbar
    _GUICtrlStatusBar_Resize($hGUICtrl_Sbar_Main)
EndFunc   ;==>_WM_SIZE
Next, a status bar on the frame GUI:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiToolbar.au3>
#include <GuiStatusbar.au3>
#include <GUIFrame.au3>

Global $hGUI_Main = GUICreate("Lyric Tag", 800, 600, Default, Default, $WS_SIZEBOX);, BitOR($WS_OVERLAPPEDWINDOW, $WS_POPUP))
GUISetState()

; Create first frame
Global $iFrame_1 = _GUIFrame_Create($hGUI_Main, 1, 50) ;, $iMain_SBar_Height, 3)

; Get handle of top pane
$hTop_Pane = _GUIFrame_GetHandle($iFrame_1, 1)
GUISetBkColor(0xFFCCCC, $hTop_Pane)
$hBot_Pane = _GUIFrame_GetHandle($iFrame_1, 2)
GUISetBkColor(0xCCFFCC, $hBot_Pane)

; ToolBar
Global $hGUICtrl_Tbar = _GUICtrlToolbar_Create($hTop_Pane)
_GUICtrlToolbar_AddBitmap($hGUICtrl_Tbar, 1, -1, $IDB_STD_LARGE_COLOR)
_GUICtrlToolbar_AddButton($hGUICtrl_Tbar, 1000, 0, _GUICtrlToolbar_AddString($hGUICtrl_Tbar, "&Cut"))
Global $iGUICtrl_TbarHeight = _GuiCtrlToolbar_GetHeight($hGUICtrl_Tbar)

; Set separator bar and set min size
_GUIFrame_SetSepPos($iFrame_1, $iGUICtrl_TbarHeight)
$aClient = WinGetClientSize($hBot_Pane)
_GUIFrame_SetMin($iFrame_1, $iGUICtrl_TbarHeight, $aClient[1], True)

; Now create second level frame
$aClient = WinGetClientSize($hBot_Pane)
Global $iFrame_2 = _GUIFrame_Create($hBot_Pane, 0)

$hLeft_Pane = _GUIFrame_GetHandle($iFrame_2, 1)
GUISetBkColor(0xCCCCFF, $hLeft_Pane)

; Create status bar inside frame
Global $hGUICtrl_Sbar_Frame = _GUICtrlStatusBar_Create($hLeft_Pane)
_GUICtrlStatusBar_SetMinHeight($hGUICtrl_Sbar_Frame, 20)
_GUICtrlStatusBar_SetText($hGUICtrl_Sbar_Frame, "Frame status bar")
$iHeight = _GUICtrlStatusBar_GetHeight($hGUICtrl_Sbar_Frame) + 6
ConsoleWrite($iHeight & @CRLF)

; Create label in right frame
_GUIFrame_Switch($iFrame_2, 1)
$aSize = WinGetClientSize($hLeft_Pane)
Global $cLabel = GUICtrlCreateLabel("", 10, 10, $aSize[0] - 20, $aSize[1] - 20 - $iHeight)
GUICtrlSetBkColor($cLabel, 0xFFFFFF)

GUISetState(@SW_SHOW, $hGUI_Main)

GUIRegisterMsg($WM_SIZE, "_WM_SIZE")

_GUIFrame_ResizeSet($iFrame_1, 1) ; Fix top frame size
_GUIFrame_ResizeSet($iFrame_2) ; Allow bottom frame to resize

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            _GUICtrlStatusBar_Destroy($hGUICtrl_Sbar_Frame)
            _GUICtrlToolbar_Destroy($hGUICtrl_Tbar)
            Exit
    EndSwitch
WEnd

Func _GuiCtrlToolbar_GetHeight(ByRef $hTbar)
    If Not IsHWnd($hTbar) Then Return SetError(1, 0, 0)
    Local $aSize = _GUICtrlToolbar_GetMaxSize($hTbar)
    Local $aPadd = _GUICtrlToolbar_GetPadding($hTbar)
    Return $aSize[1] + $aPadd[1]
EndFunc   ;==>_GuiCtrlToolbar_GetHeight

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

    _GUIFrame_SIZE_Handler($hWnd, $iMsg, $wParam, $lParam)

    ; Resize Statusbav
    _GUICtrlStatusBar_Resize($hGUICtrl_Sbar_Frame)

    ; Reset minimums for Frame_1
    $aClient = WinGetClientSize($hBot_Pane)
    _GUIFrame_SetMin($iFrame_1, $iGUICtrl_TbarHeight, $aClient[1], True)

EndFunc   ;==>_WM_SIZE
Finally, a status bar on both the main and frame GUIs:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiToolbar.au3>
#include <GuiStatusbar.au3>
#include <GUIFrame.au3>

Global $hGUI_Main = GUICreate("Lyric Tag", 800, 600, Default, Default, $WS_SIZEBOX)

; Create main statusbar
$iMain_SBar_Height = 20
Global $hGUICtrl_Sbar_Main = _GUICtrlStatusBar_Create($hGUI_Main)
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiToolbar.au3>
#include <GuiStatusbar.au3>
#include <GUIFrame.au3>

Global $hGUI_Main = GUICreate("Lyric Tag", 800, 600, Default, Default, $WS_SIZEBOX);, BitOR($WS_OVERLAPPEDWINDOW, $WS_POPUP))
GUISetState()

; Create main statusbar
$iMain_SBar_Height = 20
Global $hGUICtrl_Sbar_Main = _GUICtrlStatusBar_Create($hGUI_Main)
_GUICtrlStatusBar_SetMinHeight($hGUICtrl_Sbar_Main, $iMain_SBar_Height)
_GUICtrlStatusBar_SetText($hGUICtrl_Sbar_Main, "Main status bar")

; Create first frame
Global $iFrame_1 = _GUIFrame_Create($hGUI_Main, 1, 50) ;, $iMain_SBar_Height, 3)

; Get handle of top pane
$hTop_Pane = _GUIFrame_GetHandle($iFrame_1, 1)
GUISetBkColor(0xFFCCCC, $hTop_Pane)
$hBot_Pane = _GUIFrame_GetHandle($iFrame_1, 2)
GUISetBkColor(0xCCFFCC, $hBot_Pane)

; ToolBar
Global $hGUICtrl_Tbar = _GUICtrlToolbar_Create($hTop_Pane)
_GUICtrlToolbar_AddBitmap($hGUICtrl_Tbar, 1, -1, $IDB_STD_LARGE_COLOR)
_GUICtrlToolbar_AddButton($hGUICtrl_Tbar, 1000, 0, _GUICtrlToolbar_AddString($hGUICtrl_Tbar, "&Cut"))
Global $iGUICtrl_TbarHeight = _GuiCtrlToolbar_GetHeight($hGUICtrl_Tbar)

; Set separator bar and set min size
_GUIFrame_SetSepPos($iFrame_1, $iGUICtrl_TbarHeight)
$aClient = WinGetClientSize($hBot_Pane)
_GUIFrame_SetMin($iFrame_1, $iGUICtrl_TbarHeight, $aClient[1], True)

; Now create second level frame
$aClient = WinGetClientSize($hBot_Pane)
Global $iFrame_2 = _GUIFrame_Create($hBot_Pane, 0, 0, 5, 0, 0, 0, $aClient[1] - 25)

$hLeft_Pane = _GUIFrame_GetHandle($iFrame_2, 1)
GUISetBkColor(0xCCCCFF, $hLeft_Pane)

; Create status bar inside frame
Global $hGUICtrl_Sbar_Frame = _GUICtrlStatusBar_Create($hLeft_Pane)
_GUICtrlStatusBar_SetMinHeight($hGUICtrl_Sbar_Frame, 20)
_GUICtrlStatusBar_SetText($hGUICtrl_Sbar_Frame, "Frame status bar")
$iHeight = _GUICtrlStatusBar_GetHeight($hGUICtrl_Sbar_Frame) + 6
ConsoleWrite($iHeight & @CRLF)

; Create label in right frame
_GUIFrame_Switch($iFrame_2, 1)
$aSize = WinGetClientSize($hLeft_Pane)
Global $cLabel = GUICtrlCreateLabel("", 10, 10, $aSize[0] - 20, $aSize[1] - 20 - $iHeight)
GUICtrlSetBkColor($cLabel, 0xFFFFFF)

GUISetState(@SW_SHOW, $hGUI_Main)

GUIRegisterMsg($WM_SIZE, "_WM_SIZE")

_GUIFrame_ResizeSet($iFrame_1, 1) ; Fix top frame size
_GUIFrame_ResizeSet($iFrame_2) ; Allow bottom frame to resize

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            _GUICtrlStatusBar_Destroy($hGUICtrl_Sbar_Main)
            _GUICtrlStatusBar_Destroy($hGUICtrl_Sbar_Frame)
            _GUICtrlToolbar_Destroy($hGUICtrl_Tbar)
            Exit
    EndSwitch
WEnd

Func _GuiCtrlToolbar_GetHeight(ByRef $hTbar)
    If Not IsHWnd($hTbar) Then Return SetError(1, 0, 0)
    Local $aSize = _GUICtrlToolbar_GetMaxSize($hTbar)
    Local $aPadd = _GUICtrlToolbar_GetPadding($hTbar)
    Return $aSize[1] + $aPadd[1]
EndFunc   ;==>_GuiCtrlToolbar_GetHeight

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

    _GUIFrame_SIZE_Handler($hWnd, $iMsg, $wParam, $lParam)
    Local $aClientSize = WinGetClientSize($hGUI_Main)

    ; Resize toolbar & Resize Statusbar
    _GUICtrlStatusBar_Resize($hGUICtrl_Sbar_Main)
    _GUICtrlStatusBar_Resize($hGUICtrl_Sbar_Frame)
EndFunc   ;==>_WM_SIZE
I have often found that status bars and this UDF do not play nicely together when the GUI is resizeable. I have an idea of why this happens but I cannot find a way of amending the UDF to prevent it which does not break something else. So if the above scripts do not meet your requirements then I am afraid you are out of luck, sorry. :(

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

Thank you for your time and for providing three examples as well :)

I tried the three examples and I think I'll stick with example 1 because in both examples 2 and 3 the resizing between the status bar and the frame is not quite right. Maybe I'll just create a fake status bar using a label since I won't be displaying any thing fancy down there.

Here are the problems I found and fixed in example 1:

  • After resizing the window, the top pane containing the toolbar is resizable again to some degree
  • After resizing the window > clicking the separator of the top pane cause a weird resize of the frames and makes the top pane disappear altogether. Resizing the window again fixes everything again

I fixed the first bug by adding:

$aClient = WinGetClientSize($hBot_Pane)
_GUIFrame_SetMin($iFrame_1, $iGUICtrl_TbarHeight, $aClient[1], True)

again inside the _WM_SIZE() function.

The second bug was fixed simply by making _GUIFrame_SIZE_Handler() run first inside the _WM_SIZE() and then my resizing code. I didn't know that the order matters and put my resizing code first.

Here is example 1 with the fixes included and without a status bar.

#include <WindowsConstants.au3>
#include <ColorConstantS.au3>
#include <GUIConstantsEx.au3>
#include <GuiToolbar.au3>
#include <GUIFrame.au3>

Global $hGUI_Main = GUICreate("GUIFrame & toolbars ex", 800, 600, Default, Default, $WS_SIZEBOX)
GUISetState()

; Forget about status bars :)

; Create first frame
Global $iFrame_1 = _GUIFrame_Create($hGUI_Main, 1, 50, 3)
; Get handles of created panes
$hTop_Pane = _GUIFrame_GetHandle($iFrame_1, 1)
$hBot_Pane = _GUIFrame_GetHandle($iFrame_1, 2)
GUISetBkColor($COLOR_SKYBLUE, $hTop_Pane)

; Create ToolBar
Global $hGUICtrl_Tbar = _GUICtrlToolbar_Create($hTop_Pane)
_GUICtrlToolbar_AddBitmap($hGUICtrl_Tbar, 1, -1, $IDB_STD_LARGE_COLOR)
_GUICtrlToolbar_AddButton($hGUICtrl_Tbar, 1000, 0, _GUICtrlToolbar_AddString($hGUICtrl_Tbar, "Cut"))
Global $iGUICtrl_TbarHeight = _GuiCtrlToolbar_GetHeight($hGUICtrl_Tbar)

; Correct separator bar pos and set min size
_GUIFrame_SetSepPos($iFrame_1, $iGUICtrl_TbarHeight)
; Next 2 lines are also added inside the _WM_SIZE function because $aClient changes after resizing
$aClient = WinGetClientSize($hBot_Pane)
_GUIFrame_SetMin($iFrame_1, $iGUICtrl_TbarHeight, $aClient[1], True)

; Now create second level frame
Global $iFrame_2 = _GUIFrame_Create($hBot_Pane)
; Get handles
$hLeft_Pane = _GUIFrame_GetHandle($iFrame_2, 1)
$hRight_Pane = _GUIFrame_GetHandle($iFrame_2, 2)
GUISetBkColor($COLOR_WHITE, $hLeft_Pane)
GUISetBkColor($COLOR_SILVER, $hRight_Pane)

; Create label in left bottom pane
_GUIFrame_Switch($iFrame_2, 1)
$aSize = WinGetClientSize($hLeft_Pane)
Global $hLabel = GUICtrlCreateLabel("", 8, 8, $aSize[0]-16, $aSize[1]-16)
GUICtrlSetBkColor($hLabel, $COLOR_MONEYGREEN)

GUISetState(@SW_SHOW, $hGUI_Main)

GUIRegisterMsg($WM_SIZE, "_WM_SIZE")

_GUIFrame_ResizeSet($iFrame_1, 1) ; Fix top frame size
_GUIFrame_ResizeSet($iFrame_2) ; Allow bottom frame to resize

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

Func _GuiCtrlToolbar_GetHeight(ByRef $hTbar)
    If Not IsHWnd($hTbar) Then Return SetError(1, 0, 0)
    Local $aSize = _GUICtrlToolbar_GetMaxSize($hTbar)
    Local $aPadd = _GUICtrlToolbar_GetPadding($hTbar)
    Return $aSize[1] + $aPadd[1]
EndFunc   ;==>_GuiCtrlToolbar_GetHeight

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

    _GUIFrame_SIZE_Handler($hWnd, $iMsg, $wParam, $lParam) ; fixes the resize on click proplem

    Static Local $aClientSize = WinGetClientSize($hBot_Pane) ; fixes the top pane being resizable
    $aClientSize = WinGetClientSize($hBot_Pane)              ; After window resize
    _GUIFrame_SetMin($iFrame_1, $iGUICtrl_TbarHeight, $aClientSize[1], True)

;~  _GUIFrame_SIZE_Handler($hWnd, $iMsg, $wParam, $lParam) ; here top pane resizes on click
EndFunc   ;==>_WM_SIZE
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...