Jump to content

GUIFrame UDF - Melba23 version - 19 May 14


Melba23
 Share

Recommended Posts

Great job Melba23!

And sincere thanks to Kip for his foundational work in this area!

Your comments throughout examples really help

My 1st evaluations show some significant improvements, and though have not had lots of time

at it so far, did notice a few things right away..

1) the bar between the frames is not expanding with the borders of the frame when main Gui enlarged..

2) GUIFrame_Create($hGUI_2,1, 1, 10, 10, 200, 200) param#2 if set to > 1 makes a rectangle

3) played a bit to see if could lock the size of the individual frames when main Gui resized,

used GuiCtrlSetResizing(-1,$Gui_Dockall) to no effect..

Sorry but that is all the time I have right now, I'll try some more as I have time this weekend..

Thank you again,

RoyS

Link to comment
Share on other sites

  • Moderators

RoyS,

the bar between the frames is not expanding with the borders of the frame when main Gui enlarged

It is not supposed to and I see no reason why it should. After all, it is only there to act as the grab point for resizing. ;)

Or do you mean that it no longer stretches across the frame? If so, I am very surprised as it is resized to the same dimensions as the frames themselves. ;)

GUIFrame_Create($hGUI_2, 1, 1, 10, 10, 200, 200) param#2 if set to > 1 makes a rectangle

I am afraid I do not understand what you mean. o:)

If you write:

GUIFrame_Create($hGUI_2, 2, 1, ....

You get no frames created and the function returns 0 with an error of 2 (GUI creation failed). This is because the $iSepOrient parameter only accepts 0/1 as explained in the function header.

If you write:

GUIFrame_Create($hGUI_2, 1, 2, ....

you get the normal square GUI with 2 frames and a separator bar 3 pixels wide ($iSepSize - Size of separator bar (default = 5, min = 3, max = 9))

Could you explain your comment further? :)

if could lock the size of the individual frames when main Gui resized

Easy - do not set the resizing flag with _GUIFrame_ResizeSet for that frame. The top frame that appears when you press Button 1 is non-resizing - as you will see if you try it. Note the use of _GUIFrame_ResizeSet(0) to set the flag for all existing frames when the script starts. o:)

GuiCtrlSetResizing will not work as these are GUIs, not controls. :party:

I hope that explains most of what you asked. :P

M23

Edit: Guess!

Edited by Melba23

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

Melba23, This is really amazing! Thank you so much for sharing. All the commenting is very helpful. Posted Image

Link to comment
Share on other sites

Melba23,

Thank you for answering my initial comments,repeated here..

My 1st evaluations show some significant improvements, and though have not had lots of time

at it so far, did notice a few things right away..

1) the bar between the frames is not expanding with the borders of the frame when main Gui enlarged..

2) GUIFrame_Create($hGUI_2,1, 1, 10, 10, 200, 200) param#2 if set to > 1 makes a rectangle

3) played a bit to see if could lock the size of the individual frames when main Gui resized,

used GuiCtrlSetResizing(-1,$Gui_Dockall) to no effect..

Further evaluations this weekend I only could get it to do item #1 intermittently when playing with the parameters in

the examples.. sorry so new that I could not document what I did the 1st time to make this happen.. but

the bar did not expand with the frame when the main re-sizable Gui was enlarged, leaving a line between the

what was the original size and worked to resize, and a line to the frame edge that the mouse pointer did not change when over it.

The item 2 was an accidental use of a wrong value, easy thing to do so easy to correct .. just did not error out like

I expected and make nothing, it does make a main Child Gui to hold the frames.. I dont think either of these are critical.

In example script GuiFrame2_Example At line 11

Or

In example script GUIFrame1_Example_Reg At line 13

$iFrame_A = _GUIFrame_Create($hGUI_1,2) ;<= added ,2 got a single blank window

Item 3 was just a wish.. when min size set for both at 200 and window is 400 or less, the resize bar between the frames

still is active and gives some flicker trying to adjust.. hope that explains what I observed..

I really like the UDF, have learned a lot form the coding used about Gui .. noticed all the frames are Child in Style,

Would it be possible to have the frames come up with an option to change the size of the frames and lock them there so

the adjustment bar is there but does nothing? That way cold come back and unlock in script, change the sizes, and relock

them as desired..

Separate issue for me right now is how to Center a Gui on a monitor other than the primary one.. the @DesktopHeight and

@DesktopWidth only give Screen Size of the primary monitor, and do not account for the Tool bar in windows.. However

when a GuiCreate("",-1,-1) is used, it does center on the free area of the desktop but only on the primary monitor.. so the

Toolbar width/height is in the developers use on the primary monitor when Guicreate is used.

Further digging reveals if my main Gui is on another monitor and a msgbox is called it is centered on the non primary monitor

so the msgbox must use screen sizes of the non primary monitor to do this..

Any Thoughts? You have done so much digging into the internals of Autoit I am hoping this has been addressed at some point.

Wow.. did not mean to be so long winded when I started, please forgive... am on a deadline to finish my scripting so have

limited time, but wanted to let you know I really am thankful and appreciate your UDF's..

RoyS

Link to comment
Share on other sites

Melba23, Do you think you could take a look at this? When implementing statusbars I keep getting a little glich. Whenever the Middle frame is resized the very bottom statusbar goes away. When the Main Gui is resized it comes back. I can't figure out how to refresh the main gui after everything is done. Thanks a lot.

include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiStatusBar.au3>
#include "GUIFrame.au3"

$hGUI_1 = GUICreate("GUI Frames", 600, 500, 100, 100, $WS_SIZEBOX)

;create frames
$iFrame_A = _GUIFrame_Create($hGUI_1, 1);split gui horizontally
$iFrame_B = _GUIFrame_Create(_GUIFrame_GetHandle($iFrame_A, 1));split top frame vertically
$iFrame_C = _GUIFrame_Create(_GUIFrame_GetHandle($iFrame_A, 2), 1);split bottom frame horizontally again

;set mins
_GUIFrame_SetMin($iFrame_A, 75, 75)
_GUIFrame_SetMin($iFrame_B, 75, 75)
_GUIFrame_SetMin($iFrame_C, 75, 75)

;get handles to each frame
$hTopLeft = _GUIFrame_GetHandle($iFrame_B, 1)
$hTopright = _GUIFrame_GetHandle($iFrame_B, 2)
$hMiddleFrame = _GUIFrame_GetHandle($iFrame_C, 1)
$hBottomFrame = _GUIFrame_GetHandle($iFrame_C, 2)

;create status bars
Global $Status1, $Status2, $Status3, $Status4
Global $aStatuswidths[3] = [75,150,225]
Global $aStatusText[3] = ['One', 'Two', 'Three']
$Status1 = _GUICtrlStatusBar_Create($hTopLeft, $aStatuswidths, $aStatusText)
$Status2 = _GUICtrlStatusBar_Create($hTopright, $aStatuswidths, $aStatusText)
$Status3 = _GUICtrlStatusBar_Create($hMiddleFrame, $aStatuswidths, $aStatusText)
$Status4 = _GUICtrlStatusBar_Create($hGUI_1, $aStatuswidths, $aStatusText)
;~ $Status4 = _GUICtrlStatusBar_Create($hBottomFrame, $aStatuswidths, $aStatusText)

;Set backgound colors
GUISetBkColor(0xC0C0C0, $hTopLeft)
GUISetBkColor(0xFFC4FF, $hTopright)
GUISetBkColor(0x00D0FF, $hMiddleFrame)
GUISetBkColor(0x80FF00, $hBottomFrame)

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

_GUIFrame_ResizeSet(0)

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            _GUIFrame_Exit()
            _GUICtrlStatusBar_Destroy($Status1)
            _GUICtrlStatusBar_Destroy($Status2)
            _GUICtrlStatusBar_Destroy($Status3)
            _GUICtrlStatusBar_Destroy($Status4)
            Exit
    EndSwitch
WEnd

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

    _GUIFrame_SIZE_Handler($hWnd, $iMsg, $wParam, $lParam)
    _GUICtrlStatusBar_Resize ($Status4)
    _GUICtrlStatusBar_Resize ($Status1)
    _GUICtrlStatusBar_Resize ($Status2)
    _GUICtrlStatusBar_Resize ($Status3)

    Return $GUI_RUNDEFMSG

EndFunc
Link to comment
Share on other sites

  • Moderators

RoyS,

#1. As I explained above, the sep bar and the frames are resized using the same variables to set their common dimensions, so I cannot see how it could have happened. If you ever do find the magic combination of parameters to make it occur again, please let me know. o:)

#2. I see where the problem is here. I will alter the next release to default to a vertical sep bar if the $iSepOrient parameter is not 1. Thanks for pointing it out. ;)

#3. At present, if you set a min value which is greater than half the total size, the value is reduced to Floor((max available / 2) - sep size). Because there is often a rounding error involved here, if you do the same for both frames you might get a couple of pixels free play in the sep bar movement. I did this to cater for the user setting min values for both frames which added to more than the available size. If I were to look into changing this behaviour, what would you like to see? No promises, mind! :P

As to the lock function, I can see a number of ways to do this and could easily add a further function to the UDF, but would you mind giving me an example of when you might want to do this? To my mind, the whole idea of frames is to have dynamic adjustments to the display area. :)

M23

Edit: No idea about secondary monitors. I suggest a new topic in the Support forum asking the question. ;)

Edited by Melba23

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

Beege,

That one is easy! :)

Creating the status bar for the main GUI reduces the client size available for the frames. You have already created the frames before you add the main GUI status bar, so the frames overwrite the status bar added later when they use the original client area on resize. Resizing the whole GUI overwrites the frames again.

Solution: Place the status bar on the main GUI BEFORE you create the frames:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiStatusBar.au3>
#include "GUIFrame.au3"

Global $Status1, $Status2, $Status3, $Status4
Global $aStatuswidths[3] = [75,150,225]
Global $aStatusText[3] = ['One', 'Two', 'Three']

$hGUI_1 = GUICreate("GUI Frames", 600, 500, 100, 100, $WS_SIZEBOX)
; Create main GUI status bar
$Status4 = _GUICtrlStatusBar_Create($hGUI_1, $aStatuswidths, $aStatusText) ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<< Here

;create frames
$iFrame_A = _GUIFrame_Create($hGUI_1, 1);split gui horizontally
$iFrame_B = _GUIFrame_Create(_GUIFrame_GetHandle($iFrame_A, 1));split top frame vertically
$iFrame_C = _GUIFrame_Create(_GUIFrame_GetHandle($iFrame_A, 2), 1);split bottom frame horizontally again

;set mins
_GUIFrame_SetMin($iFrame_A, 75, 75)
_GUIFrame_SetMin($iFrame_B, 75, 75)
_GUIFrame_SetMin($iFrame_C, 75, 75)

;get handles to each frame
$hTopLeft = _GUIFrame_GetHandle($iFrame_B, 1)
$hTopright = _GUIFrame_GetHandle($iFrame_B, 2)
$hMiddleFrame = _GUIFrame_GetHandle($iFrame_C, 1)
$hBottomFrame = _GUIFrame_GetHandle($iFrame_C, 2)

;create frame status bars

$Status1 = _GUICtrlStatusBar_Create($hTopLeft, $aStatuswidths, $aStatusText)
$Status2 = _GUICtrlStatusBar_Create($hTopright, $aStatuswidths, $aStatusText)
$Status3 = _GUICtrlStatusBar_Create($hMiddleFrame, $aStatuswidths, $aStatusText)
;~ $Status4 = _GUICtrlStatusBar_Create($hBottomFrame, $aStatuswidths, $aStatusText) ; <<<<<<<<<<<<<<<<<< Not here

;Set backgound colors
GUISetBkColor(0xC0C0C0, $hTopLeft)
GUISetBkColor(0xFFC4FF, $hTopright)
GUISetBkColor(0x00D0FF, $hMiddleFrame)
GUISetBkColor(0x80FF00, $hBottomFrame)

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

_GUIFrame_ResizeSet(0)

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            _GUIFrame_Exit()
            _GUICtrlStatusBar_Destroy($Status1)
            _GUICtrlStatusBar_Destroy($Status2)
            _GUICtrlStatusBar_Destroy($Status3)
            _GUICtrlStatusBar_Destroy($Status4)
            Exit
    EndSwitch
WEnd

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

    _GUIFrame_SIZE_Handler($hWnd, $iMsg, $wParam, $lParam)
    _GUICtrlStatusBar_Resize ($Status4)
    _GUICtrlStatusBar_Resize ($Status1)
    _GUICtrlStatusBar_Resize ($Status2)
    _GUICtrlStatusBar_Resize ($Status3)

    Return $GUI_RUNDEFMSG

EndFunc

All clear? ;)

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

We are all clear! Thanks again. Posted Image

Link to comment
Share on other sites

Melba23,

Thank you for your reply and I will let you know the parameters for the "possible" problem

I saw with the sizing bar..

The use of a single child Gui is solution to my "would be nice" request, have used this now

in my program and so you sure dont need to add such into the frames udf.

Found member "Motuatronic2010" had posted in the General Help forum a helpful zipped file of

udf library of monitor access and parameters. It is a bit over my head but am evaluating

and learning from it.. may have a solution there to my question about centering on multiple

monitors.

At any rate, you have really helped me to better understand how child gui integrations work.

Keep up the great work, it is really appreciated, Thank you.

RoyS

Link to comment
Share on other sites

Melba23, I got another glitch similar to the last. When trying to resize the main GUI, the ListViews I created that take up the entire client area are geting resized wrong.

In the example below, when it first starts you should see vertical and horizontal scroll bars for both frames. Once any resize happens to the main GUI, the Listviews are resized to large or something because all both horizontal scroll bars and one vertical disappear. Hopefully its as easy as the last one to fix. Thanks ;)

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

Global $g_hGUI = GUICreate("GUI Frames", 300, 300, -1, -1, $WS_SIZEBOX)
GUISetState(@SW_SHOW)

;create frames
$g_Frames = _GUIFrame_Create($g_hGUI);split gui horizontally
_GUIFrame_SetMin($g_Frames, 75, 75)

;get handles to each frame
$g_hLeft = _GUIFrame_GetHandle($g_Frames, 1)
$g_hRight = _GUIFrame_GetHandle($g_Frames, 2)

;create Listview 1
_GUIFrame_Switch($g_Frames, 1)
$aClient = WinGetClientSize($g_hLeft)
$listview = GUICtrlCreateListView('column 1 | column  2 | column 3', 0, 0, $aClient[0], $aClient[1])
GUICtrlSetResizing(-1, 102)

;create Listview 2
_GUIFrame_Switch($g_Frames, 2)
$aClient = WinGetClientSize($g_hRight)
$listview2 = GUICtrlCreateListView('column 1 | column  2 | column 3', 0, 0, $aClient[0], $aClient[1])
GUICtrlSetResizing(-1, 102)

;Add some items to listviews
For $i = 1 to 20
    GUICtrlCreateListViewItem('item ' & $i, $listview)
    GUICtrlCreateListViewItem('item ' & $i, $listview2)
Next

GUIRegisterMsg($WM_SIZE, "_WM_SIZE")
_GUIFrame_ResizeSet(0)

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
_GUIFrame_Exit()

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

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

    Return $GUI_RUNDEFMSG

EndFunc
Link to comment
Share on other sites

  • Moderators

Beege,

Thanks for finding that bug - not too difficult to find and fix. I was using WinGetPos and not WinGetClientSize in part of the resizing code and so the frames were incorrectly resized too large - as you noticed. :)

New version in the first post - your script works fine for me with this version. ;)

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

Beege,

Thanks for finding that bug - not too difficult to find and fix. I was using WinGetPos and not WinGetClientSize in part of the resizing code and so the frames were incorrectly resized too large - as you noticed. :)

New version in the first post - your script works fine for me with this version. ;)

M23

Excellent! Posted Image

Link to comment
Share on other sites

  • 1 month later...
  • Moderators

[NEW VERSION - 4 Nov 10] - Added user-defined intial position of separator bar within Frame. New UDF & example code and zip in first post.

Warning: Script-breaking syntax change. You need to adjust the calling syntax if you used any parameters other than the separator orientation.

Sorry about that, but I felt keeping the various parameters in logical groups was more important. :graduated:

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

  • 4 weeks later...

Melba23,

Good idea about the intial position. Do you know of a way that I could retrieve or calculate the current position of the separator? My goal is to be able to save and then restore positioning.. ThanksPosted Image

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