Jump to content

GUI_Extender - New Version 16 Apr 2022


Melba23
 Share

Recommended Posts

  • 1 month later...

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

 

Link to comment
Share on other sites

  • Moderators

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

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

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

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

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

 

Link to comment
Share on other sites

  • Moderators

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

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

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 :)

Link to comment
Share on other sites

  • Moderators

[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

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

Most honored @Melba23, or anyone else knowledgeable about the awesome GUIExtender UDF, I have some questions regarding its usage. These are pre-use questions, since that UDF makes for challenging reading for someone like me.  I'd just like to make sure it can do what I'd like to do (it almost certainly does, but I'd rather know otherwise now before I dive in towards comprehension).  These questions will presume affirmative answers, but if the reality is otherwise, please let me know.  I'll be working in On Event mode.

GUIExtender does allow placing binary image buttons in an extension, right?  I can't imagine that it doesn't, since as my Indian math professor used to very frequently say: "It really doesn't matter" to that UDF.

And there'll be no issues at all using it in multiple monitor mode, I'm pretty confident of that, especially since I'll ensure that even at maximum extension, it will not cross or change monitors.

One of the things I want to do is to use @Creator's  GUICtrl_SetOnHover UDF, which will alter the button image upon mouse hover and exit.  The mode I want to use Registers "WM_COMMAND" and "WM_LBUTTONDOWN". Will these interfere with GUIExtender?

... Actually, I think those are my only questions.  Thank you for your time!

Link to comment
Share on other sites

  • Moderators

Mbee,

I am afraid the answers are necessarily a bit vague but I hope they are useful:

1. The UDF can cope with buttons created by both the native GUICtrlCreateButton function and the UDF function GUICtrlButton_Create, so I imagine it should cope with your "special"  buttons but I have never tried.

2. I have never used the UDF in multiple monitor mode (I have but the one) but I see no reason why it should not.

3. The UDF uses no Windows message handlers, so I see no reason a priori why it should not work with other UDFs. But a word of warning, in the past I have found MrCreator's UDFs to be rather intolerant of other UDFs being used at the same time - usually the conflict centres on the various Windows message handlers which need to coexist, so as my UDF does not use any it might well work without problem.

And I would be happy to help you get the UDF working with your script - so do not lose any sleep over its "challenging" nature. If you explain how you want your GUI to behave I am sure we can come up with a suitable script.

M23

P.S. Why did you not post this in the UDF thread? I will move it there once you have replied.

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 hours ago, Melba23 said:

Mbee,

I am afraid the answers are necessarily a bit vague but I hope they are useful:

1. The UDF can cope with buttons created by both the native GUICtrlCreateButton function and the UDF function GUICtrlButton_Create, so I imagine it should cope with your "special"  buttons but I have never tried.

2. I have never used the UDF in multiple monitor mode (I have but the one) but I see no reason why it should not.

3. The UDF uses no Windows message handlers, so I see no reason a priori why it should not work with other UDFs. But a word of warning, in the past I have found MrCreator's UDFs to be rather intolerant of other UDFs being used at the same time - usually the conflict centres on the various Windows message handlers which need to coexist, so as my UDF does not use any it might well work without problem.

And I would be happy to help you get the UDF working with your script - so do not lose any sleep over its "challenging" nature. If you explain how you want your GUI to behave I am sure we can come up with a suitable script.

M23

P.S. Why did you not post this in the UDF thread? I will move it there once you have replied.

 

Thanks bunches, Melba23!  And I'm afraid I'll have to take you up on your extremely gracious offer of help! :D

Please go ahead an move this thread; the main reason I didn't post there was because I was leery of re-opening there, since I didn't want to choose poorly.

Link to comment
Share on other sites

Hi again, @Melba23 ! 

Thank you once again for your magnanimous offer of assistance!  You're so f..ing awesome

So my application design started with using only one monitor, since the overwhelming number of computer owners only have the one.  And in that single monitor mode, the size and position of all the controls is fixed and can't be changed.  But my app would be much more flexible and useful in dual-monitor mode, and with so many people now owning computer-attached Home Theaters, many more people actually have two monitors: The computer display and their HDTV (of course, this requires that the computer have two distinct graphics output connectors, which is also extremely common these days).

By the way, all of this will be done in Event Mode.

The single monitor mode always has 6 of what I call "slots". They always come in pairs of two, left and right.  Each of these slots contain 4 basic controls: a label that you can also drop files onto along with a context menu, and three picture buttons for operations on that slot. But I want all the buttons to have two display modes, one normal and another for when the mouse hovers over them. For that I'll be using MrCreatoR's "GUICtrlOnHover" UDF.

There will be one fixed button to increase the number of slots (technically pairs of slots), and another to reduce their number. Therefore there's no need to include any extension button in the extended area, simplifying things a bit.

Like in single monitor mode, the dual Slots GUI will start with 3 pairs of slots, created the usual way.  But I'm afraid I'm having difficulty in determining which of your UDFs functions to invoke to increase or decrease the number of pairs of slots and create the picture buttons and drop-enabled labels and setting up the hovering.  I've read through your UDF and the examples you've provided and ran them to see what they do (all of which are quite amazing! Wow!), but I have to admit I'm just too stupid to figure out which functions I should invoke.

Now, I realize that's probably not enough to go on, and I know how much everyone wants to see the code I've come up with so they can evaluate and offer fixes or alternatives, but I honestly don't know quite where to begin.  For example, one of the input arguments to your _GUIExtender_Init() func is the logical variable $bComplex. Is what I've described complex or not?

And I'm unclear what you mean by "activate" with your function _GUIExtender_Section_Activate(). Also, it looks clear that the "buttons" you refer to in the input arguments relate to the "extend" and "retract" buttons.  Does it matter that I'll have only one of each, and they'll be outside the extended area? All of these arguments have defaults, but I'm not clear on what those defaults will do in my case.

Finally, I'm not clear about how to populate the extended area with the labels and buttons.  I realize that these controls are created the usual way, but to use dropable labels or picture buttons or context menus, one needs to know their GUI-relative coordinates and dimensions in advance. Your _GUIExtender_Section_Create() function returns a "Section ID", which looks like it's actually a three-dimensional array rather than a control ID.  If it were a normal control ID, I could get it's coordinates and dimensions easily, but how do I obtain that info from your returned array?  Is that data structure described somewhere I couldn't find, or ... Wait: I see, you call _GUIExtender_Section_BaseCoord(). What does that data structure look like?  Does it include the sections dimensions or just it's left and top coordinates?

There's more I don't yet understand, but this post is already over-long ;).  Please take your time in answering, I feel guilty enough already for taking so much of your time...

THANKS!

Link to comment
Share on other sites

Mbee,

Here is some basic example on how the _GUIExtender_Section_BaseCoord  function can be used, .. compare it with the original GUIExtender_Example_3_Handle_Loop.au3

Regardless to the UDF, a $YCoord var (as in this example) is Setting\Getting the top coordinates while progressing through a gui creation

You get to change or use the Top value without needing to fully specify it with each and every creation of a control or a group of them
one example could be wanting to move a group of controls all at once while keeping their relative spacing in check, you change their above $YCoord var value instance by an Increase or decrease and they remain subject to it (moved all at once ..)

in this example using the UDF, I combined setting a new Top value with each _Section() creation function call

look through the example to see if you get idea ..

Deye

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

Global $hGUI = GUICreate("Test", 300, 390)
Global $aSections[6] = [0, 60, 60, 60, 110, ""] ;Array to set section split sizes from $hGUI hight
Global $YCoord = 0

_GUIExtender_Init($hGUI)

_Section(1)
GUICtrlCreateGroup(" 1 - Static ", 10, ($YCoord + 10), 280, 50) ; $aSections[0] = 0 + 10 = 10
_GUIExtender_Section_Activate($hGUI, 2, "", "", 270, ($YCoord + 40), 15, 15, 0, 1) ; Normal button

_Section(2) ;   Auto resets $YCoord  = $aSections[1] = 60
GUICtrlCreateGroup(" 2 - Extendable ", 10, ($YCoord + 10), 280, 50) ; ($YCoord + 10), top = 70

_Section(3) ;  Auto resets $YCoord  = $aSections[1]+[2] = 120
GUICtrlCreateGroup(" 3 - Static", 10, ($YCoord + 10), 280, 50) ; top = 130
_GUIExtender_Section_Activate($hGUI, 4, "Close 4", "Open 4", 225, ($YCoord + 25), 60, 20, 1, 1) ; Push button

_Section(4) ;  Auto resets $YCoord  =  180
GUICtrlCreateGroup(" 4 - Extendable ", 10, ($YCoord + 10), 280, 100) ;top = 190

$YCoord -= 20 ; $YCoord  override =  160

GUICtrlCreateGroup(" 4 - Extendable ", 10, $YCoord, 280, 100) ; top = 160

_Section(5) ; Auto resets $YCoord

$YCoord += 10 ; $YCoord  override to 350

GUICtrlCreateGroup(" 5 - Static", 10, $YCoord , 280, 80)

_GUIExtender_Section_Activate($hGUI, 0, "Close All", "Open All", 20, ($YCoord + 60), 60, 20, 1, 1) ; Normal button

_GUIExtender_Section_Create($hGUI, -99)

GUICtrlCreateGroup("", -99, -99, 1, 1)

GUISetState(@SW_HIDE, $hGUI)

; Create non-native controls and child GUIs AFTER main GUI

; Create a UDF combo
$hCombo = _GUICtrlComboBox_Create($hGUI, "", 120, 90, 60, 20, $CBS_DROPDOWN) ; BitOR($CBS_DROPDOWN, $WS_VSCROLL, $WS_TABSTOP, $CBS_UPPERCASE))
_GUICtrlComboBox_BeginUpdate($hCombo)
_GUICtrlComboBox_AddString($hCombo, "ONE")
_GUICtrlComboBox_AddString($hCombo, "TWO")
_GUICtrlComboBox_AddString($hCombo, "THREE")
_GUICtrlComboBox_EndUpdate($hCombo)
; Store handle data in UDF
_GUIExtender_Handle_Data($hGUI, $hCombo, 2, 120, 90) ; Note coords are relative to main GUI

; Create child GUI
$hGUI_Child = GUICreate("", 270, 80, 15, 205, $WS_POPUP)
GUISetBkColor(0xCCFFCC, $hGUI_Child)
GUISetState(@SW_SHOWNOACTIVATE, $hGUI_Child)
_WinAPI_SetParent($hGUI_Child, $hGUI)
_GUIExtender_Handle_Data($hGUI, $hGUI_Child, 4, 15, 205)

; Retract section with combo
_GUIExtender_Section_Action($hGUI, 4, False)

GUISetState(@SW_SHOW, $hGUI)

While 1
    $aMsg = GUIGetMsg(1)
    Switch $aMsg[0]
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
    _GUIExtender_EventMonitor($aMsg[1], $aMsg[0])
WEnd

Func _Section($iSection_Coord = 0, $iSection_Size = Default)
    _GUIExtender_Section_Create($hGUI, $iSection_Size, $aSections[$iSection_Coord])
    $YCoord = _GUIExtender_Section_BaseCoord($hGUI, $iSection_Coord)
EndFunc   ;==>_Section

 

Edited by Deye
Link to comment
Share on other sites

  • Moderators

Mbee,

Quote

Now, I realize that's probably not enough to go on, and I know how much everyone wants to see the code I've come up with

I could not have put it better myself! How about you writing some basic GUI code (without any of the frills or any working functions) or draw a picture to show what you want your user to see. If you provide one with all sections retracted and another with all sections extended, that will allow me to see just what we need to do. Then we can get the various sections working as you wish before you head off onto the complex bits.

As to your questions on the UDF:

  •  $bComplex is explained in this post from the previous thread - unless you use UpDowns you need not concern yourself with it.
  • _GUIExtender_Section_Activate makes a section actionable - either by creating a button within the UDF or allowing the user to use one of their own. If you do not use the function, the section is static an cannot be actioned.
  • As to creating the GUI, you create the whole GUI in one initial block of code, with all of the controls in a section being created between the relevant starting and ending _GUIExtender_Section_Create calls.
  • Deye has already explained _GUIExtender_Section_BaseCoord - basically it allows you to create controls easily with a section without knowing exactly where that section is situated within the overall GUI.

The third of those points makes me a little concerned as you speak of having buttons to increase decrease the number of controls. The UDF requires you to create all the controls initially so that it knows where they are situated within the overall GUI. You cannot adjust the size of the actionable sections dynamically. If you want to do this, one way would be to have to have child GUIs in those sections and have scrollable areas within them to access all of these "slots" of which you speak (my Scrollbars UDF should be able to cope with this). Another would be to have entirely separate child windows which you can resize at will and simply display attached to your base GUI.  You need to be aware of these limitations before we get too deep into the code.

Anyway, let me see what you want the user to see and I am sure we can come up with something suitable.

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

  • 2 weeks later...

Kind @Deye and @Melba23, thank you for your efforts!  I apologize for the delay in responding; aside from dealing with a difficult family issue, I've been coding and debugging what I've already done (which allowed me to reach the point where most everything is working but the complexities), but due in large part to a hair-tearing bug/confusion that I'll be asking for help with next in another thread, I have not yet reached the stage where I can start posting example code or begin analyzing Deye's code.  I expected to be ready for this a while ago, but I encountered so many difficulties dealing with multiple monitors and other issues that I'm just not there yet.

Again, I apologize and hope to return here to post code samples and examples as soon as possible, but realistically I don't expect that to happen for at least another week.

Thanks again.

Link to comment
Share on other sites

  • 2 years later...

So - I don't know if this is a bug or not, but I believe it is.

When I have a spinner in my hidden section, it is - of course - made of an input GUI (GUICtrlCreateInput) that is then placed in a spinner (GUICtrlCreateUpdown)

Without the hidden section it works fine. Once it's in the hidden/collapsed section the UpDown arrows disappear and I'm only left with the input box.

 

GuiExtender_Bug.png

Link to comment
Share on other sites

  • Moderators

hummus,

This is a known problem with UpDowns - as I explained in this post in the previous UDF thread.

So the solution is to set the $bComplex parameter in your _GUIExtender_Init call to True - that way the UDF does the necessary magic internally and your UpDowns should be visible again.

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

  • 2 weeks later...

Melba23,

I have another small issue that I'm not sure how to fix.

I have a few sections in my GUI that are greyed out (disabled) until I checkmark them with a checkbox. However - once I do - they don't just turn on anymore, they "double" - or - show a ghosting of where they should have been had the GUIExtender section been expanded.

I'm not sure how to fix that (maybe I need to better define where each section starts and ends - though I've been unsuccessful with that), but the temporary fix I've done is that whenever that checkbox is checked to enable/disable the rest of the GUI - I also add this:

_GUIExtender_Section_Action($mainWin, $Settings_Section, 9)
_GUIExtender_Section_Action($mainWin, $Settings_Section, 9)

Basically - I'm toggling the GUIExtender to the opposite of what it was, twice (as in - expand, then collapse back - if that's how it started) - and that refreshes the GUI and all looks fine. The only problem with that is that I have that momentarily jump in the GUI because of this quick expand/collapse.

In the attached image you can see what it looks like when I don't use these toggling lines.

Thanks.

guiextender_hack.png

Link to comment
Share on other sites

  • Moderators

hummus,

Can you please post some reproducer code so that I can debug - that way I am sure I am using the same code as you.

M23

Edit: This is important because i cannot reproduce the same effect in this example script:

#include <GUIConstantsEx.au3>

#include "GUIExtender.au3"

Global $fState = False

$hGUI_1 = GUICreate("Test", 300, 180)

_GUIExtender_Init($hGUI_1, 0, 0, True)

_GUIExtender_Section_Create($hGUI_1, 0, 60)
GUICtrlCreateGroup(" 1 - Static ", 10, 10, 280, 50)
; Create action button for next section
_GUIExtender_Section_Activate($hGUI_1, 2, "", "", 270, 40, 15, 15) ; Normal button

_GUIExtender_Section_Create($hGUI_1, Default, 110) ; using Default for position follows on from previous sections
GUICtrlCreateGroup(" 2 - Extendable ", 10, 70, 280, 100)

$cCheck = GUICtrlCreateCheckbox("Enable/Disable Input", 20, 90, 200, 20)

$cInput = GUICtrlCreateInput(5, 20, 130, 50, 20)
GUICtrlCreateUpdown($cInput)
GUICtrlSetState($cInput, $GUI_DISABLE)

; Close section creation
_GUIExtender_Section_Create($hGUI_1, -99)

GUICtrlCreateGroup("", -99, -99, 1, 1)

GUISetState()

While 1
    $aMsg = GUIGetMsg(1)
    Switch $aMsg[0]
        Case $GUI_EVENT_CLOSE
            Exit
        Case $cCheck
            If GUICtrlRead($cCheck) = $GUI_CHECKED Then
                GUICtrlSetState($cInput, $GUI_ENABLE)
            Else
                GUICtrlSetState($cInput, $GUI_DISABLE)
            EndIf

    EndSwitch

    _GUIExtender_EventMonitor($aMsg[1], $aMsg[0]) ; Check for click on section action control

WEnd

So there must be something different in how your code is structured to produce this effect.

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 changed the title to GUI_Extender - New Version 16 Apr 2022

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