Jump to content

Recommended Posts

  • 9 months later...
Posted

Hi Melba23 and thanks for your cool UDFs, here's a little question, is there a way to embed a child GUI inside an extendable section ? Here's a little test script, I have commented the lines that I would like to work but that unfortunately don't until now...

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

Opt("GUIOnEventMode", 1)

$hGUI_1 = GUICreate("GUI Extender with Child GUI test", 300, 180, 100, 100)
GUISetBkColor(0xBBCCFF, $hGUI_1)
GUISetOnEvent($GUI_EVENT_CLOSE, "On_Exit")

_GUIExtender_Init($hGUI_1)

_GUIExtender_Section_Start($hGUI_1, 0, 60)
GUICtrlCreateGroup(" 1 - Static ", 10, 10, 280, 50)
_GUIExtender_Section_Action($hGUI_1, 2, "", "", 270, 40, 15, 15, 0, 1) ; Normal button
_GUIExtender_Section_End($hGUI_1)

_GUIExtender_Section_Start($hGUI_1, 60, 110)
GUICtrlCreateGroup(" 2 - Extendable ", 10, 70, 280, 100)
;~ $childGUI = GUICreate("Child", 280, 100, 10, $WS_POPUP, -1, $hGUI_1)
;~ GUISetBkColor(0xAACF0C, $childGUI)
;~ GUISetState(@SW_SHOW, $childGUI)
;~ DllCall("user32.dll", "int", "SetParent", "hwnd", WinGetHandle($childGUI), "hwnd", WinGetHandle($hGUI_1))
;~ _GUIScrollbars_Generate($childGUI, 2000, 0, 0, 0, Default, 7)
_GUIExtender_Section_End($hGUI_1)

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

GUISetState()

While 1
    Sleep(50)
WEnd
Func On_Exit()
    Exit
EndFunc   ;==>On_Exit
  • Moderators
Posted

CodingCody37,

You mean like this? :huh:

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

Opt("GUIOnEventMode", 1)

$hGUI_1 = GUICreate("GUI Extender with Child GUI test", 300, 180, 100, 100)
GUISetBkColor(0xBBCCFF, $hGUI_1)
GUISetOnEvent($GUI_EVENT_CLOSE, "On_Exit")

_GUIExtender_Init($hGUI_1)

_GUIExtender_Section_Start($hGUI_1, 0, 60)
GUICtrlCreateGroup(" 1 - Static ", 10, 10, 280, 50)
_GUIExtender_Section_Action($hGUI_1, 2, "", "", 270, 40, 15, 15, 0, 1) ; Normal button
_GUIExtender_Section_End($hGUI_1)

_GUIExtender_Section_Start($hGUI_1, 60, 110)
GUICtrlCreateGroup(" 2 - Extendable ", 10, 70, 280, 100)
_GUIExtender_Section_End($hGUI_1)

GUISetState()

$childGUI = GUICreate("Child", 280, 90, 10, 80, $WS_POPUP, -1, $hGUI_1)
GUISetBkColor(0xFFCCCC, $childGUI)
GUISetState(@SW_SHOW, $childGUI)
_WinAPI_SetParent($childGUI, $hGUI_1)
_GUIScrollbars_Generate($childGUI, 2000, 0, 0, 0, Default, 7)

While 1
    Sleep(50)
WEnd

Func On_Exit()
    Exit
EndFunc   ;==>On_Exit
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:

  Reveal hidden contents

 

Posted (edited)

  On 8/19/2014 at 5:19 PM, Melba23 said:

CodingCody37,

You mean like this? :huh:

M23

 

 

definitely ! The answer was very simple, my brain was focused on "putting the elements in the sections" and I've put the lines of code to mimic that without actually thinking at what I was writing lol ...it looks so clear and obvious now than I'm a bit ashamed hehe, thanks for the heads-up !

// I can see that my code even had a childGUI where I somehow deleted the "top" parameter by mistake, ty for the correction as well :-)

Edited by CodingCody37
  • Moderators
Posted (edited)

CodingCody37,

If you have sections below the child GUI, you need to do a bit more:

<snip>

All clear I hope. :)

M23

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

  Reveal hidden contents

 

Posted (edited)

Thank you ! You're anticipating questions, I guess that's called being experienced ^^ , yes I will have sections lying under, thus I would have obviously came across this little tweak that you showed me ;-)

Edited by CodingCody37
  • Moderators
Posted

CodingCody37,

 

  Quote

You're anticipating questions, I guess that's called being experienced

Thanks - and I have come up with another scenario where you will need to do even more. If the child GUI has retractable sections above it we will need to relocate the child GUI to its new position if they are extended/retracted. I have some working code to do just that - but I will see if I can make it easier for the coder by getting it all into a single function. Stay tuned! :)

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:

  Reveal hidden contents

 

  • Moderators
Posted (edited)

Hi,

Here is modified UDF and example which will cater for embedded child GUIs:

<snip>

Comments welcomed. :)

M23

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

  Reveal hidden contents

 

Posted (edited)

There is small issue with GUI.

EDIT: I attach png where you can see how scrollbar is not correctly refreshed/repainted.

post-10673-0-57314300-1408484733.png

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted (edited)

great ! gonna look at this tomorrow, off to bed right now. It's nice that you took it a little further, because as you've guessed, embedding GUIs to retractable sections is really useful, especially in my case where I needed to use your easy scrollbars, thus I needed that kind of child GUI !

Edited by CodingCody37
  • Moderators
Posted

mLipok,

That is an artefact caused by the overlap of the group frame and the scrollbar. I already redraw the child GUI - I would have thought that the scrollbars would have been redrawn too, but evidently not. Anyway, if you reduce the child height by 10 pixels it no longer appears - and how often will there be overlapping group frames and scrollbars anyway? ;)

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:

  Reveal hidden contents

 

Posted

Just a quick note about mLipok's screenshot, this is also a typical case where your NoFocusLines UDF is handy, because if you watch the tiny arrow button used to develop or retract the section, with the dotted selection lines around it looks wrong (because of the small size), so getting rid of them is good in this case ^^

Posted (edited)

  On 8/19/2014 at 8:04 PM, Melba23 said:

Hi,

Here is modified UDF and example which will cater for embedded child GUIs:

<snip>

Comments welcomed. :)

M23

 

Just tested and I must say ..nice ! And thanks because that's a piece of code that would obviously have been needed a moment or another, and you just made it even simplier by adding it to the UDF itself, allowing us to build even more complicated apps with minimum thinking. Thumbs up!

 

I could go crazy and build a "La Vache qui rit" GUI :

ndo0vd.jpg

 

(in other words, infinite nested retractable stuff lol... sorry I'm french and that's a thing coming to my mind right away when thinking of "Mise en abyme" !)

 

I remember once doing this with operating systems and virtual machines.. installing win98 on WinXP on..Win7 host haha...just for fun

Edited by Melba23
Link to old Beta removed
  • Moderators
Posted

CodingCody37,

Glad you like it. I will write some header info for the added functions and release a new version in the next few days. :)

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:

  Reveal hidden contents

 

  • Moderators
Posted (edited)

CodingCody37 (and anyone else reading),

Here is a more polished Beta version with even easier syntax which mirrors the existing function for UDF-created controls:

<snip>

Please comment, report bugs, etc. :)

M23

Edited by Melba23
Removed Beta code

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:

  Reveal hidden contents

 

  • Moderators
Posted (edited)

Back again,

There was a problem with minimizing and restoring the GUI with the earlier code. A lot of testing shows that you must NOT use the parent parameter when creating the child GUI, or else you do not get a $GUI_EVENT_RESTORE message. I have also merged the code for embedding UDF-created controls and child GUIs into a single function - all you need to do is set a parameter to tell the UDF what it is dealing with - as you can see here:

<snip>

As usual, comments welcome from any testers. :)

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:

  Reveal hidden contents

 

  • Moderators
Posted

[New version] - 24 Aug 14

Added: Ability to embed child GUIs. Child GUIs must be created with the $WS_POPUP style and the _WinAPI_SetParent function used, not the "parent" parameter of GUICreate.

This is a script-breaking change. The old _GUIExtender_UDFCtrlCheck function has been replaced with the new _GUIExtender_HandleCheck function which deals with both UDF-created controls and child GUIs, Just replace the old function name with the new one - no other syntax changes needed.

New UDF and examples in zip in 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:

  Reveal hidden contents

 

  • 5 months later...
Posted

Hello,

I'm a new user on this forum, I used to be on the French autoit forum, but even if I'm not very good with my English I need your help.
 
First thank you for your UDF, very useful.
I'm making some lab and I try to make Guiextender work.
 
I'm new to Autoit.

Anyway I'll try to combine resources.udf with your udf but I have somes bugs.

>Resources UDF link

Well here my script : and yeah I borrowed >from it on your topic for trying.

This intend to be a network checkup.

  Reveal hidden contents

You can download it here.

Well my problem is when I unhide my gui, my controls go away

First :

15o9sh5.png

Then when I unhide

kd4vpd.png

My green square become huge et my red square disapear.

Thank you for your help

  • Moderators
Posted

Stormgrade,

If by "hide/unhide" you mean "minimize/restore" then you need to call the _GUIExtender_Restore function when a $GUI_EVENT_RESTORE event occurs. When I add that the GUI behave normally:

$hGUI = GUICreate("Vertical", 300, 170, 100, 100)
GUISetOnEvent($GUI_EVENT_CLOSE, "On_Exit")
GUISetOnEvent($GUI_EVENT_Restore, "_GUIExtender_Restore") ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
I hope that solves your problem. :)

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:

  Reveal hidden contents

 

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...