Jump to content

Child GUI in Adult GUI Problem!


 Share

Recommended Posts

Ok, so im trying to create a child gui within an adult, purely because the adult gui doesnt change, however, clicking controls on the adult gui hides/shows child guis in the same window. Im crap with explaining so heres some lovely pictures!!

Ok, this is was I WANT it to look like:

The 5 labels along the bottom are from the adult gui (the rest of the adult gui is just a white background - nothing else)

The input box and the listview are both in the child gui.

Posted Image

And i got that gui from this code i wrote:

#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

Opt("GUIOnEventMode",1)
$FRM = GUICreate("", 626, 470, -1, -1,$WS_DLGFRAME)
GUISetBkColor(0xFFFFFF)
$LBL1 = GUICtrlCreateLabel("BUT1", 24, 392, 100, 37)
GUICtrlSetOnEvent(-1,"test")
GUICtrlSetFont(-1, 20, 400, 0, "Calibri")
$LBL2 = GUICtrlCreateLabel("BUT2", 136, 392, 139, 37)
GUICtrlSetFont(-1, 20, 400, 0, "Calibri")
$LBL4 = GUICtrlCreateLabel("BUT4", 424, 392, 78, 37)
GUICtrlSetFont(-1, 20, 400, 0, "Calibri")
$LBL5 = GUICtrlCreateLabel("BUT5", 528, 392, 68, 37)
GUICtrlSetFont(-1, 20, 400, 0, "Calibri")
$LBL3 = GUICtrlCreateLabel("BUT3", 296, 392, 115, 37)
GUICtrlSetFont(-1, 20, 400, 0, "Calibri")
GUISetState(@SW_SHOW)

Sleep(2000)
Create()
While 1
Sleep(1000)

WEnd

Func test()

GUIDelete($FRM1)

EndFunc

Func Create()

Global $FRM1 = GUICreate("", 626, 401, 0, 0, $WS_EX_MDICHILD, $FRM)
GUISetBkColor(0xFFFFFF)
$IP = GUICtrlCreateInput("", 16, 16, 593, 41)
GUICtrlSetFont(-1, 20, 400, 0, "Calibri")
$LSTVIEW = GUICtrlCreateListView("", 8, 64, 609, 161)

GUISetState(@SW_SHOW)

EndFunc

When i run this code, it sometimes shows the gui as above..other times (without even changing the code), it shows this:

Posted Image

...which is just the adult gui...i dont know why the child doesnt show?!

and sometimes it shows this:

Posted Image

Which ever one it "chooses" to show is completely at random, and i dont know what is up?

The fact its different most times is a little odd as there are no random variables in the script to make it so...i was just hoping someone had some insight into this..possibly a solution, and maybe to try the code out themselves to see if the same happens to you...also, if you get one of the latter two style creations..stop the execution by going tools/stop execution rather than right clicking the icon in the corner...otherwise it goes into crazy loops :).

Thanks in advance!!

Instant Lockerz Invite - www.instantlockerzinvite.co.uk
Link to comment
Share on other sites

I'm not sure but maybe this is what you want.

#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

Global $FRM1, $IP, $LSTVIEW, $origparent
Opt("GUIOnEventMode", 1)
$FRM = GUICreate("", 626, 470, -1, -1, BitOR($WS_CLIPCHILDREN,$WS_DLGFRAME))
GUISetBkColor(0xFFFFFF)
$LBL1 = GUICtrlCreateLabel("BUT1", 24, 392, 100, 37)
GUICtrlSetOnEvent(-1, "test")
GUICtrlSetFont(-1, 20, 400, 0, "Calibri")
$LBL2 = GUICtrlCreateLabel("BUT2", 136, 392, 139, 37, $WS_CLIPSIBLINGS)
GUICtrlSetFont(-1, 20, 400, 0, "Calibri")
$LBL4 = GUICtrlCreateLabel("BUT4", 424, 392, 78, 37)
GUICtrlSetFont(-1, 20, 400, 0, "Calibri")
$LBL5 = GUICtrlCreateLabel("BUT5", 528, 392, 68, 37)
GUICtrlSetFont(-1, 20, 400, 0, "Calibri")
$LBL3 = GUICtrlCreateLabel("BUT3", 296, 392, 115, 37)
GUICtrlSetFont(-1, 20, 400, 0, "Calibri")
GUISetState(@SW_SHOW)

Sleep(2000)
Create()

While 1
    Sleep(1000)

WEnd

Func test()

    GUIDelete($FRM1)

EndFunc ;==>test

Func Create()
    $FRM1 = GUICreate("", 618, 401, 0, 0, BitOR($WS_CAPTION, $WS_SIZEBOX))
    GUISetBkColor(0xFFFFFF)
    $IP = GUICtrlCreateInput("fgnfgn", 16, 16, 593, 41)
    GUICtrlSetFont(-1, 20, 400, 0, "Calibri")
    $LSTVIEW = GUICtrlCreateListView("fgfg", 8, 64, 609, 161)
    $origparent = DllCall("user32.dll", "int", "SetParent", "hwnd", $FRM1, "hwnd", $FRM)
    GUISetState(@SW_SHOW)
EndFunc ;==>Create
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

I'm not sure but maybe this is what you want.

#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

Global $FRM1, $IP, $LSTVIEW, $origparent
Opt("GUIOnEventMode", 1)
$FRM = GUICreate("", 626, 470, -1, -1, BitOR($WS_CLIPCHILDREN,$WS_DLGFRAME))
GUISetBkColor(0xFFFFFF)
$LBL1 = GUICtrlCreateLabel("BUT1", 24, 392, 100, 37)
GUICtrlSetOnEvent(-1, "test")
GUICtrlSetFont(-1, 20, 400, 0, "Calibri")
$LBL2 = GUICtrlCreateLabel("BUT2", 136, 392, 139, 37, $WS_CLIPSIBLINGS)
GUICtrlSetFont(-1, 20, 400, 0, "Calibri")
$LBL4 = GUICtrlCreateLabel("BUT4", 424, 392, 78, 37)
GUICtrlSetFont(-1, 20, 400, 0, "Calibri")
$LBL5 = GUICtrlCreateLabel("BUT5", 528, 392, 68, 37)
GUICtrlSetFont(-1, 20, 400, 0, "Calibri")
$LBL3 = GUICtrlCreateLabel("BUT3", 296, 392, 115, 37)
GUICtrlSetFont(-1, 20, 400, 0, "Calibri")
GUISetState(@SW_SHOW)

Sleep(2000)
Create()

While 1
    Sleep(1000)

WEnd

Func test()

    GUIDelete($FRM1)

EndFunc ;==>test

Func Create()
    $FRM1 = GUICreate("", 618, 401, 0, 0, BitOR($WS_CAPTION, $WS_SIZEBOX))
    GUISetBkColor(0xFFFFFF)
    $IP = GUICtrlCreateInput("fgnfgn", 16, 16, 593, 41)
    GUICtrlSetFont(-1, 20, 400, 0, "Calibri")
    $LSTVIEW = GUICtrlCreateListView("fgfg", 8, 64, 609, 161)
    $origparent = DllCall("user32.dll", "int", "SetParent", "hwnd", $FRM1, "hwnd", $FRM)
    GUISetState(@SW_SHOW)
EndFunc ;==>Create

Thanks, but im still having the same problem...well, when i tried your code as is written there, the child opened in another window...so i added the $FRM as the parent to $FRM1, just incase youd accidently missed it off, i was getting the same problems as before.

Sometimes i would be getting it how i wanted (like in the first image) but i was getting the other styles of creation just as much...i will quickly try to just put a screen movie of what i am doing so you can have a look.

Also, have you found the gui is not always creating in the same way?

Thanks for your help..anymore is VERY welcome!! :)

Instant Lockerz Invite - www.instantlockerzinvite.co.uk
Link to comment
Share on other sites

Thanks, but im still having the same problem...well, when i tried your code as is written there, the child opened in another window...so i added the $FRM as the parent to $FRM1, just incase youd accidently missed it off, i was getting the same problems as before.

Sometimes i would be getting it how i wanted (like in the first image) but i was getting the other styles of creation just as much...i will quickly try to just put a screen movie of what i am doing so you can have a look.

Also, have you found the gui is not always creating in the same way?

Thanks for your help..anymore is VERY welcome!! :)

The child opened in another window? Not the $FRM window?

I suspect you are using the latest Windows Haloween with service pack 666.

What happens if you try this version?

#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <winapi.au3>
#include <constants.au3>
Global $FRM1, $IP, $LSTVIEW, $origparent
Opt("GUIOnEventMode", 1)
$FRM = GUICreate("", 626, 470, -1, -1, BitOR($WS_CLIPCHILDREN,$WS_DLGFRAME))
GUISetBkColor(0xFFFFFF)
$LBL1 = GUICtrlCreateLabel("BUT1", 24, 392, 100, 37)
GUICtrlSetOnEvent(-1, "test")
GUICtrlSetFont(-1, 20, 400, 0, "Calibri")
$LBL2 = GUICtrlCreateLabel("BUT2", 136, 392, 139, 37, $WS_CLIPSIBLINGS)
GUICtrlSetFont(-1, 20, 400, 0, "Calibri")
$LBL4 = GUICtrlCreateLabel("BUT4", 424, 392, 78, 37)
GUICtrlSetFont(-1, 20, 400, 0, "Calibri")
$LBL5 = GUICtrlCreateLabel("BUT5", 528, 392, 68, 37)
GUICtrlSetFont(-1, 20, 400, 0, "Calibri")
$LBL3 = GUICtrlCreateLabel("BUT3", 296, 392, 115, 37)
GUICtrlSetFont(-1, 20, 400, 0, "Calibri")
GUISetState(@SW_SHOW)

Sleep(2000)
Create()

While 1
    Sleep(1000)

WEnd

Func test()

    GUIDelete($FRM1)

EndFunc ;==>test

Func Create()

    $FRM1 = GUICreate("", 618, 401, 0, 0, BitOR($WS_CAPTION, $WS_SIZEBOX,$WS_CHILD),-1,$FRM);, $WS_EX_TOPMOST, $FRM);, $WS_EX_MDICHILD, $FRM)
    GUISetBkColor(0xFFFFFF)
    $IP = GUICtrlCreateInput("fgnfgn", 16, 16, 593, 41)
    GUICtrlSetFont(-1, 20, 400, 0, "Calibri")
    $LSTVIEW = GUICtrlCreateListView("fgfg", 8, 64, 609, 161)
    $iFlags = BitOR($SWP_SHOWWINDOW, $SWP_NOSIZE, $SWP_NOMOVE,$SWP_ASYNCWINDOWPOS)
    _WinAPI_SetWindowPos($FRM1, $HWND_TOP, 0, 0, 0, 0, $iFlags);$HWND_TOP
     GUISetState(@SW_SHOW)
EndFunc ;==>Create

What OS are you using? (Assuming my guess was wrong.)

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

The child opened in another window? Not the $FRM window?

I suspect you are using the latest Windows Haloween with service pack 666.

What happens if you try this version?

#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <winapi.au3>
#include <constants.au3>
Global $FRM1, $IP, $LSTVIEW, $origparent
Opt("GUIOnEventMode", 1)
$FRM = GUICreate("", 626, 470, -1, -1, BitOR($WS_CLIPCHILDREN,$WS_DLGFRAME))
GUISetBkColor(0xFFFFFF)
$LBL1 = GUICtrlCreateLabel("BUT1", 24, 392, 100, 37)
GUICtrlSetOnEvent(-1, "test")
GUICtrlSetFont(-1, 20, 400, 0, "Calibri")
$LBL2 = GUICtrlCreateLabel("BUT2", 136, 392, 139, 37, $WS_CLIPSIBLINGS)
GUICtrlSetFont(-1, 20, 400, 0, "Calibri")
$LBL4 = GUICtrlCreateLabel("BUT4", 424, 392, 78, 37)
GUICtrlSetFont(-1, 20, 400, 0, "Calibri")
$LBL5 = GUICtrlCreateLabel("BUT5", 528, 392, 68, 37)
GUICtrlSetFont(-1, 20, 400, 0, "Calibri")
$LBL3 = GUICtrlCreateLabel("BUT3", 296, 392, 115, 37)
GUICtrlSetFont(-1, 20, 400, 0, "Calibri")
GUISetState(@SW_SHOW)

Sleep(2000)
Create()

While 1
    Sleep(1000)

WEnd

Func test()

    GUIDelete($FRM1)

EndFunc ;==>test

Func Create()

    $FRM1 = GUICreate("", 618, 401, 0, 0, BitOR($WS_CAPTION, $WS_SIZEBOX,$WS_CHILD),-1,$FRM);, $WS_EX_TOPMOST, $FRM);, $WS_EX_MDICHILD, $FRM)
    GUISetBkColor(0xFFFFFF)
    $IP = GUICtrlCreateInput("fgnfgn", 16, 16, 593, 41)
    GUICtrlSetFont(-1, 20, 400, 0, "Calibri")
    $LSTVIEW = GUICtrlCreateListView("fgfg", 8, 64, 609, 161)
    $iFlags = BitOR($SWP_SHOWWINDOW, $SWP_NOSIZE, $SWP_NOMOVE,$SWP_ASYNCWINDOWPOS)
    _WinAPI_SetWindowPos($FRM1, $HWND_TOP, 0, 0, 0, 0, $iFlags);$HWND_TOP
     GUISetState(@SW_SHOW)
EndFunc ;==>Create

What OS are you using? (Assuming my guess was wrong.)

haha, no just your standard xp32bit, i think sp3...well, i recorded it all and whacked it on youtube...i have just tried that new bit of code you posted, and it gives out exactly the same format as the first one in the movie...youll see..

i dont know if im able to post links on this forum so just piece it back together again!

http:/ /www. youtube. com/watch?v=_ZFhQbh74TU

Thanks!!

Instant Lockerz Invite - www.instantlockerzinvite.co.uk
Link to comment
Share on other sites

haha, no just your standard xp32bit, i think sp3...well, i recorded it all and whacked it on youtube...i have just tried that new bit of code you posted, and it gives out exactly the same format as the first one in the movie...youll see..

i dont know if im able to post links on this forum so just piece it back together again!

http:/ /www. youtube. com/watch?v=_ZFhQbh74TU

Thanks!!

I have no idea why your system behaves like that, so I can't help :)

BTW, what did you use to make the recording?

Edited by martin
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

I have no idea why your system behaves like that, so I can't help :)

BTW, what did you use to make the recording?

Thanks for trying anyways!

Just some freeware called CamStudio...http://camstudio.org/

EDIT: Just tried this on my lappyt off my dusty shelf..and have had exactly the same issues...has absolutly nobody else trying either my original script or martin's improved script had the same problem as me?

Thanks everyone

Edited by furrycow
Instant Lockerz Invite - www.instantlockerzinvite.co.uk
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...