Melba23

GUI_Extender - New Version 17 Apr 17

8 posts in this topic




#2 ·  Posted

Hi Melba,

Will it be possible for you to add something that will just hide\disable the controls for a section when Two or more sections will be using using the same region - so it becomes useful like tabs ..

Also some idea that when setting a _GUIExtender_Section_Create :

when creating a new control under a section:
we can have the y position of the control added to where _GUIExtender_Section_Create initiates the region  

so for instance in the background what happens is this :

$hGUI = GUICreate("Parent GUI", 340, 360)
$iSection_1 = _GUIExtender_Section_Create($hGUI, -1, 90)
$iYPos = 90 ;noted
$iSection_2 = _GUIExtender_Section_Create($hGUI, -1 , -1)
$Radio1 = GUICtrlCreateRadio("_Section_2", 10 + $iYPos, 104, 89, 25)

So depending on what sections are hidden or shown ,controls are to be always organized inside their own sections ( solves my first noted request)

also wanted to ask how should I be using the new UDF version  ( just to get me going .., sorry for the unclear sketchy example)
I Also noticed some problem with special controls after minimizing and restore with the older UDF (will test later ..)

Thanks

#include <GUIConstantsEx.au3>
#include "GUIExtender.au3"

$hGUI = GUICreate("Parent GUI", 340, 360)

;~ _GUIExtender_Init($hGUI)
_GUIExtender_Init($hGUI, 0, 0, True)

; This section starts at 0 and is 90 pixels deep
$iSection_1 = _GUIExtender_Section_Create($hGUI, -1, 90)

$Button = GUICtrlCreateButton(Chr(0x71), 208, 10, 115, 25, 0, 1)
GUICtrlSetFont(-1, 10, 600, -1, "WingDings 3")

$Label1 = GUICtrlCreateLabel("first-section", 216, 48, 70, 19)

$iSection_2 = _GUIExtender_Section_Create($hGUI, 90, -1)
$Radio1 = GUICtrlCreateRadio("_Section_2", 170, 104, 89, 25)
$Radio2 = GUICtrlCreateRadio("_Section_2", 170, 136, 89, 25)
$Radio3 = GUICtrlCreateRadio("_Section_2", 170, 168, 89, 25)
 GUICtrlSetState(-1, $GUI_CHECKED)

$iSection_3 = _GUIExtender_Section_Create($hGUI, 90, 160)
$Radio4 = GUICtrlCreateRadio("_Section_3", 170, 104, 89, 25)
$Radio5 = GUICtrlCreateRadio("_Section_3", 170, 136, 89, 25)
$Radio6 = GUICtrlCreateRadio("_Section_3", 170, 168, 89, 25)

$iSection_4 = _GUIExtender_Section_Create($hGUI, 160, -1)
$Radio4 = GUICtrlCreateRadio("_Section_4", 170, 204, 89, 25)
$Radio5 = GUICtrlCreateRadio("_Section_4", 170, 236, 89, 25)
$Radio6 = GUICtrlCreateRadio("_Section_4", 170, 268, 89, 25)

Global $cInput = GUICtrlCreateInput("0", 92, 238, 10, 17)
Global $cUpDown_Min = GUICtrlCreateUpdown($cInput)
Global $cTimer_Label = GUICtrlCreateLabel("12", 56, 240, 30, 15)
GUISetState(@SW_SHOW)
;~ _GUIExtender_Section_Action($hGUI, $iSection_2, True)
_GUIExtender_Section_Action($hGUI, $iSection_2, 0,9)
_GUIExtender_Section_Action($hGUI, $iSection_3, 0,9)
_GUIExtender_Section_Action($hGUI, $iSection_4, 0,0)


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button
            MsgBox(0,  _GUIExtender_Section_State($hGUI, $iSection_2),'here it is showing as static - return of  - 2')
            If _GUIExtender_Section_State($hGUI, $iSection_2) = 2 Then
                _GUIExtender_Section_Action($hGUI, $iSection_2, False)
                _GUIExtender_Section_Action($hGUI, $iSection_3, True)
            Else
                _GUIExtender_Section_Action($hGUI, $iSection_3, False)
                _GUIExtender_Section_Action($hGUI, $iSection_2, True)
            EndIf
    EndSwitch
WEnd

 

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Deye,

Quote

just hide\disable the controls for a section when Two or more sections will be using using the same region

That is essentially what the UDF does already so I have no idea what you mean. Each section must have its own controls (which must have their ControlIDs stored in separate variables) created between _Section_Create calls (rather like when creating tabs) and only the visible ones can be actioned. In the script you posted  the radio controls share either coordinates or ControlID variables - how on earth do you expect the UDF to sort out what you want to do? What I suggest is to create the whole GUI at maximum size (i.e. all section expanded) with all its controls (for all sections) first and then create the sections by inserting the _Section_Create calls at the appropriate places - that way you get all the controls in the correct sections. Perhaps if you tried that way of constructing your GUI you would have fewer problems?

Quote

have the y position of the control added to where _GUIExtender_Section_Create initiates the region  

I see the interest in using the previous section position as used in the UDF to create the controls - but doing as I explained above removes the necessity to do so as you create the entire GUI before the sections. However, let me have a think about how such a thing might be implemented without causing too many script-breaking changes to the current UDF.

I will also take a look at the script you posted to see if I can get it to work as I think you wish it behave.

M23

Edit: That was one seriously messed up attempt to use the UDF - did you actually look at any of the examples? This seems to work:

#include <GUIConstantsEx.au3>
#include "GUIExtender.au3"

$hGUI = GUICreate("Parent GUI", 340, 360)

;~ _GUIExtender_Init($hGUI)
_GUIExtender_Init($hGUI, 0, 0, True)

; This section starts at 0 and is 90 pixels deep
$iSection_1 = _GUIExtender_Section_Create($hGUI, -1, 90)

$Button = GUICtrlCreateButton(Chr(0x71), 208, 10, 115, 25, 0, 1)
GUICtrlSetFont(-1, 10, 600, -1, "WingDings 3")

$Label1 = GUICtrlCreateLabel("first-section", 216, 48, 70, 19)

;$iSection_2 = _GUIExtender_Section_Create($hGUI, 90, -1) ; You are asking the UDF to create this section starting at 90 and fill the remainder of the GUI
$iSection_2 = _GUIExtender_Section_Create($hGUI, -1, 90)  ; Now you are askign for a 90 pixel section to follow on from the previous
$Radio1 = GUICtrlCreateRadio("_Section_2.1", 170, 104, 89, 25) ; So these must be within the y coord range 90-180 - which they are
$Radio2 = GUICtrlCreateRadio("_Section_2.2", 170, 126, 89, 25)
$Radio3 = GUICtrlCreateRadio("_Section_2.3", 170, 148, 89, 25)
GUICtrlSetState(-1, $GUI_CHECKED)
; You also need to activate the section
_GUIExtender_Section_Activate($hGUI, $iSection_2) ; Now the section can be activated programatically by the button

;$iSection_3 = _GUIExtender_Section_Create($hGUI, 90, 160) ; you are sking this section to begin at 90 (which is where the previous started so the call will error
$iSection_3 = _GUIExtender_Section_Create($hGUI, -1, 160)  ; Now you will have section starting after the previous (180) and 160 deep
;$Radio4 = GUICtrlCreateRadio("_Section_3", 170, 104, 89, 25) ; So these are not within the section boundaries (180-340) and will not be recognised by the UDF
;$Radio5 = GUICtrlCreateRadio("_Section_3", 170, 136, 89, 25)
;$Radio6 = GUICtrlCreateRadio("_Section_3", 170, 168, 89, 25)
$Radio4 = GUICtrlCreateRadio("_Section_3.1", 170, 204, 89)
$Radio5 = GUICtrlCreateRadio("_Section_3.2", 170, 226, 89)
$Radio6 = GUICtrlCreateRadio("_Section_3.3", 170, 248, 89)
; You also need to activate this sectiontoo
_GUIExtender_Section_Activate($hGUI, $iSection_3)

; These need to be created in the section which will hold them, so I have moved them there
Global $cInput = GUICtrlCreateInput("0", 92, 238, 10, 17)
Global $cUpDown_Min = GUICtrlCreateUpdown($cInput)
Global $cTimer_Label = GUICtrlCreateLabel("12", 56, 240, 30, 15)

; $iSection_4 = _GUIExtender_Section_Create($hGUI, 160, -1) ; Again you are asking the section to start in the wrong place which will error
$iSection_4 = _GUIExtender_Section_Create($hGUI, -1, -1)    ; All you can do is to ask it fill the remaoining space - all 20 pixels of it!!!
;$Radio4 = GUICtrlCreateRadio("_Section_4", 170, 204, 89, 25) ; And again these are outside the section boundaries (340-360)
;$Radio5 = GUICtrlCreateRadio("_Section_4", 170, 236, 89, 25)
;$Radio6 = GUICtrlCreateRadio("_Section_4", 170, 268, 89, 25)
$Radio7 = GUICtrlCreateRadio("_Section_4.1", 170, 340, 89, 20)
; This ection is not sctivated and so will remain static under whichever of 2 or 3 is showing

_GUIExtender_Section_Create($hGUI, -99) ; And you never close the section definiton

; So where are these supposed to be? Looking at the coordinate they should be in Section 3, so put them there
;Global $cInput = GUICtrlCreateInput("0", 92, 238, 10, 17)
;Global $cUpDown_Min = GUICtrlCreateUpdown($cInput)
;Global $cTimer_Label = GUICtrlCreateLabel("12", 56, 240, 30, 15)

GUISetState(@SW_SHOW)

;~ _GUIExtender_Section_Action($hGUI, $iSection_2, True)
_GUIExtender_Section_Action($hGUI, $iSection_3, 0, 9)  ; Closing section 3
;_GUIExtender_Section_Action($hGUI, $iSection_4, 0, 0) ; This section is static so no point


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button
            ;MsgBox(0, _GUIExtender_Section_State($hGUI, $iSection_2), 'here it is showing as static - return of  - 2') ; of course becasue you never activated it
            ;If _GUIExtender_Section_State($hGUI, $iSection_2) = 2 Then
            ;   _GUIExtender_Section_Action($hGUI, $iSection_2, False)
            ;   _GUIExtender_Section_Action($hGUI, $iSection_3, True)
            ;Else
            ;   _GUIExtender_Section_Action($hGUI, $iSection_3, False)
            ;   _GUIExtender_Section_Action($hGUI, $iSection_2, True)
            ;EndIf
            ; just toggle the sections
            _GUIExtender_Section_Action($hGUI, $iSection_2, 9)
            _GUIExtender_Section_Action($hGUI, $iSection_3, 9)
    EndSwitch
WEnd

Does that make it clearer?

Edited by Melba23
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

#4 ·  Posted (edited)

Deye,

And here is a Beta version of the UDF which I think answers your request to locate controls inside each section relative to the section itself, together with the reworked example using the new functionality:

<snip>

 

#include <GUIConstantsEx.au3>
#include "GUIExtender_Mod.au3"

$hGUI = GUICreate("Parent GUI", 340, 360)

;~ _GUIExtender_Init($hGUI)
_GUIExtender_Init($hGUI, 0, 0, True)

; This section starts at 0 and is 90 pixels deep
$iSection_1 = _GUIExtender_Section_Create($hGUI, -1, 90)

$Button = GUICtrlCreateButton(Chr(0x71), 208, 10, 115, 25, 0, 1)
GUICtrlSetFont(-1, 10, 600, -1, "WingDings 3")

$Label1 = GUICtrlCreateLabel("first-section", 216, 48, 70, 19)

;$iSection_2 = _GUIExtender_Section_Create($hGUI, 90, -1) ; You are asking the UDF to create this section starting at 90 and fill the remainder of the GUI
$iSection_2 = _GUIExtender_Section_Create($hGUI, -1, 90)  ; Now you are asking for a 90 pixel section to follow on from the previous

$iSectionBaseCoord = _GUIExtender_Section_BaseCoord($hGUI, $iSection_2) ; Get the start coordinate of the section <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

; use that value to position the controls within the section relative to the start - no need to know the absolute value <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
$Radio1 = GUICtrlCreateRadio("_Section_2.1", 170, $iSectionBaseCoord + 14, 89, 25) ; So these must be within the y coord range 90-180 - which they are
$Radio2 = GUICtrlCreateRadio("_Section_2.2", 170, $iSectionBaseCoord + 36, 89, 25)
$Radio3 = GUICtrlCreateRadio("_Section_2.3", 170, $iSectionBaseCoord + 58, 89, 25)
GUICtrlSetState(-1, $GUI_CHECKED)
; You also need to activate the section
_GUIExtender_Section_Activate($hGUI, $iSection_2) ; Now the section can be activated programatically by the button

;$iSection_3 = _GUIExtender_Section_Create($hGUI, 90, 160) ; you are sking this section to begin at 90 (which is where the previous started so the call will error
$iSection_3 = _GUIExtender_Section_Create($hGUI, -1, 160)  ; Now you will have section starting after the previous (180) and 160 deep

$iSectionBaseCoord = _GUIExtender_Section_BaseCoord($hGUI, $iSection_3)

;$Radio4 = GUICtrlCreateRadio("_Section_3", 170, 104, 89, 25) ; So these are not within the section boundaries (180-340) and will not be recognised by the UDF
;$Radio5 = GUICtrlCreateRadio("_Section_3", 170, 136, 89, 25)
;$Radio6 = GUICtrlCreateRadio("_Section_3", 170, 168, 89, 25)
$Radio4 = GUICtrlCreateRadio("_Section_3.1", 170, $iSectionBaseCoord + 44, 89)
$Radio5 = GUICtrlCreateRadio("_Section_3.2", 170, $iSectionBaseCoord + 66, 89)
$Radio6 = GUICtrlCreateRadio("_Section_3.3", 170, $iSectionBaseCoord + 88, 89)
; You also need to activate this sectiontoo
_GUIExtender_Section_Activate($hGUI, $iSection_3)

; These need to be created in the section which will hold them, so I have moved them there
Global $cInput = GUICtrlCreateInput("0", 92, 238, 10, 17)
Global $cUpDown_Min = GUICtrlCreateUpdown($cInput)
Global $cTimer_Label = GUICtrlCreateLabel("12", 56, 240, 30, 15)

; $iSection_4 = _GUIExtender_Section_Create($hGUI, 160, -1) ; Again you are asking the section to start in the wrong place which will error
$iSection_4 = _GUIExtender_Section_Create($hGUI, -1, -1)    ; All you can do is to ask it fill the remaoining space - all 20 pixels of it!!!

$iSectionBaseCoord = _GUIExtender_Section_BaseCoord($hGUI, $iSection_4)

;$Radio4 = GUICtrlCreateRadio("_Section_4", 170, 204, 89, 25) ; And again these are outside the section boundaries (340-360)
;$Radio5 = GUICtrlCreateRadio("_Section_4", 170, 236, 89, 25)
;$Radio6 = GUICtrlCreateRadio("_Section_4", 170, 268, 89, 25)
$Radio7 = GUICtrlCreateRadio("_Section_4.1", 170, $iSectionBaseCoord, 89, 20)
; This ection is not sctivated and so will remain static under whichever of 2 or 3 is showing

_GUIExtender_Section_Create($hGUI, -99) ; And you never close the section definiton

; So where are these supposed to be? Looking at the coordinate they should be in Section 3, so put them there
;Global $cInput = GUICtrlCreateInput("0", 92, 238, 10, 17)
;Global $cUpDown_Min = GUICtrlCreateUpdown($cInput)
;Global $cTimer_Label = GUICtrlCreateLabel("12", 56, 240, 30, 15)

GUISetState(@SW_SHOW)

;~ _GUIExtender_Section_Action($hGUI, $iSection_2, True)
_GUIExtender_Section_Action($hGUI, $iSection_3, 0, 9)  ; Closing section 3
;_GUIExtender_Section_Action($hGUI, $iSection_4, 0, 0) ; This section is static so no point


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button
            ;MsgBox(0, _GUIExtender_Section_State($hGUI, $iSection_2), 'here it is showing as static - return of  - 2') ; of course becasue you never activated it
            ;If _GUIExtender_Section_State($hGUI, $iSection_2) = 2 Then
            ;   _GUIExtender_Section_Action($hGUI, $iSection_2, False)
            ;   _GUIExtender_Section_Action($hGUI, $iSection_3, True)
            ;Else
            ;   _GUIExtender_Section_Action($hGUI, $iSection_3, False)
            ;   _GUIExtender_Section_Action($hGUI, $iSection_2, True)
            ;EndIf
            ; just toggle the sections
            _GUIExtender_Section_Action($hGUI, $iSection_2, 9)
            _GUIExtender_Section_Action($hGUI, $iSection_3, 9)
    EndSwitch
WEnd

Quite a useful functionality - thanks for suggesting it. I will now do some more testing on the function code and should release a new UDF before too long.

M23

Edited by Melba23
Beta code removed
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

Wow, that was fast 

3 hours ago, Melba23 said:

That was one seriously messed up attempt to use the UDF - did you actually look at any of the examples?

Since my former attempts with the new UDF weren't going in the right direction , I didn't get a chance to polish it out yet , so yes, again sorry for that ;)

 

40 minutes ago, Melba23 said:

Quite a useful functionality - thanks for suggesting it. I will now do some more testing on the function code and should release a new UDF before too long.

 
 Cool!,  may I also suggest you check out what happens upon minimizing and restoring states (where a different redraw occurs)

Thanks again for all the patience and examples

 

Share this post


Link to post
Share on other sites

#6 ·  Posted

Deye,

Quote

suggest you check out what happens upon minimizing and restoring states

All that is taken care of automatically if you add the _EventMonitor function to your idle loop. My turn to apologise as I did not do that in the examples I posted.

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

#7 ·  Posted

No probs Melba, Thanks

The iSectionBaseCoord is great since if I need to push all control at once in 40 range moves
I can just use $iSectionBaseCoord += 40 without the need to set y positions for each control in a section
So, of course there is no limits to what can be done from here ..

I'm still trying to debug why the first section in my main script is showing bigger then in the UDF used from the older thread and sections are all over lapped since I'm using the same region ..
I tried to follow the examples in the zip file and the good advice, but still no go.
For now I'll take it as a challenge to try and figure it out by myself !

I think I could have found the culprit with a small debugger, showing perhaps just the Sectionstart > controls > SectionEnd for all Y positions, maybe!, and spot what parameters don't play well, Or if a limitation was encountered .etc
 
but I might move to just hiding and showing controls, after all the GUI I need isn't a complexed one and its for expanding to one same region and like tabs so it might be overkill to what I really need (may just give up the expanding\hiding part)

we'll see :)

Share this post


Link to post
Share on other sites

#8 ·  Posted

[New Version] - 17 Apr 17

Added: Using the default values for $iSection_Coord when creating a section means that the actual coordinate value is not immediately apparent to the user, but it can now be determined via the _GUIExtender_Section_BaseCoord function. This value can then be used to position the controls relative to this section base coordinate and not in absolute GUI terms. As an added bonus, doing so also allows the size of previous sections to be altered without having to recode every single control position in subsequent sections. Look at Ex 9 to see it working.  Thanks to Deye fro the idea.

New zip with UDF and examples in the first post.

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

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