Jump to content
Sign in to follow this  
tweakster2010

[SOLVED]Child Window Questions

Recommended Posts

tweakster2010

Hey guys, Been awhile.

I am creating a calculator with settings to store to a file but the issue i am working on figuring out is getting the child window to behave properly on loading and shutting down.

 

Currently This is an example of my setup

 

Switch GuiGetMsg($Calc)
        Case $GUI_EVENT_CLOSE
            Exit
        Case $SettingItemOptions
            Call(CalcOptions)
            
Func CalcOptions()
$CalcOptions = GUICreate("Options", 335, 396, 1010, 164,-1,$WS_EX_MDICHILD,$Calc)
GUISetState(@SW_SHOW)
While 1
Switch GUIGetMsg($CalcOptions)
    Case $OptionsCancel
        Return
        GUIDelete($CalcOptions)

EndSwitch
WEnd
EndFunc

Now this is trimmed down but its minus all the inputs. The idea is when I am closing and opening it its got odd behavior.

Issues:

           1:  When it is opening it does not pull the the front window until i click the parent gui.

           2:  When I hit cancel(optionscancel) it does nothing (i tried "return" before and after guidelete) and I tried where guigetmsg was a variable instead and without calling the variables.

 

any help is totally appreciated. :) I am doing the call and returns the same way I have another program functioning but this one i am creating it as a child instead of a separate instance i guess... Maybe that is where I am messing up?

<EDIT 1>

Fixed the Optionscancel, i did not exitloop but used exit with gui close and that apparently conflicts with it. The main issue now is it loading  and showing up first, I want the parent to stay in the background and the new gui to show up just it isnt doing such. This seems to be a trend I post and figure it out after I post >.>

Edited by tweakster2010

Share this post


Link to post
Share on other sites
MikahS

Could you please provide us with an actual reproducer script? This script you have provided is so jumbled I can't understand the true problem you are having.


Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ

 

Share this post


Link to post
Share on other sites
tweakster2010

Yes sorry, its a little indepth and i was focusing on the snippet portion that isnt working.

This should be replicatable, i just removed labels / inputs / additional options. otherwise its copy and pasted.

 

I also just discovered it is throwing the child window to the far right of the screen usually off screen based on where the parent window is located... >.>

Global $Calc

Installations()



Func Installations()
$Calc = GUICreate("Calculator", 301, 506, 1165, 157)

$SettingsMenu = GuiCtrlCreateMenu("&Settings")
    $SettingItemOptions = GUICtrlCreateMenuItem("Options", $SettingsMenu)
    
GUISetState(@SW_SHOW

While 1
    Sleep(10)
    Switch GuiGetMsg()
        Case $GUI_EVENT_CLOSE
            ExitLoop
        Case $SettingItemOptions
            Call(Options)
            
EndSwitch
WEnd
EndFunc

Func Options()

$CalcOptions = GUICreate("Options", 335, 396, 1010, 164,-1,$WS_EX_MDICHILD,$Calc)
$OptionsCancel = GUICtrlCreateButton("Cancel", 208, 328, 65, 33)
GUISetState(@SW_SHOW)
While 1
Switch GUIGetMsg()
    Case $OptionsCancel
        GUIDelete($CalcOptions)
        Return

    Case $GUI_EVENT_CLOSE
        GUIDelete($CalcOptions)
        Return

EndSwitch
WEnd
EndFunc

 

Share this post


Link to post
Share on other sites
tweakster2010

Figured it out! I had a moment...

this fixed it! i totally derped on top and left

$CalcOptions = GUICreate("Options", 335, 396, -1, -1,-1,$WS_EX_MDICHILD,$Calc)

 

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
Sign in to follow this  

×