Sign in to follow this  
Followers 0
mschol

GUI parent and child windows

4 posts in this topic

#1 ·  Posted (edited)

i want to create/show a child window when i press a button in the parent gui

i got to this:

$gui = GUICreate("Read Movie files",225,64,default,default);
$input = GUICtrlCreateInput("",8,10,160)
$browsebutton = GUICtrlCreateButton("&Browse",173,10,46,20);
$settingbutton = GUICtrlCreateButton("&Settings",8,35,46,20);
$exitbutton = GUICtrlCreateButton("&Exit",173,35,46,20);
GUISetState(@SW_SHOW)

$child = GUICreate("Settings",100,200,500,-1,$WS_CHILD,default,$gui);
GUISetState(@SW_HIDE,$child)

While 1
$msg = GUIGetMsg()

 if $msg = $GUI_EVENT_CLOSE Or $msg = $exitbutton Then Exit 
 if $msg = $browsebutton Then
  GUICtrlSetState($browsebutton,$GUI_DISABLE);
  GUICtrlSetData($browsebutton,"Searching...");
  $data = FileSelectFolder("Select folder","",2,"::{20D04FE0-3AEA-1069-A2D8-08002B30309D}")
  if $data <> "" Then
   GUICtrlSetData($input,$data);
   GUICtrlSetData($browsebutton,"Browse");
   GUICtrlSetState($browsebutton,$GUI_ENABLE);
  Else
   GUICtrlSetData($input,"canceled...");
   GUICtrlSetData($browsebutton,"Browse");
   GUICtrlSetState($browsebutton,$GUI_ENABLE);
  EndIf
 EndIf
 if $msg = $settingbutton Then
  GUISwitch($child)
  GUISetState(@SW_SHOW,$child)
 EndIf
WEnd

but i cant get the child window to show...?

any help on using this please?

the documentation isnt very clear on this...

in the child gui i plan to be able to change some settings (from ini file or registery, dont know yet)

how do i process that? (after a click on a save button in the child gui?)

Edited by mschol

Share this post


Link to post
Share on other sites



here try this

#include <GUIConstants.au3>
$gui = GUICreate("Read Movie files",225,64,default,default);
$ParentWin_Pos = WinGetPos($gui, "")
$input = GUICtrlCreateInput("",8,10,160)
$browsebutton = GUICtrlCreateButton("&Browse",173,10,46,20);
$settingbutton = GUICtrlCreateButton("&Settings",8,35,46,20);
$exitbutton = GUICtrlCreateButton("&Exit",173,35,46,20);
GUISetState(@SW_SHOW)


While 1
$msg = GUIGetMsg()

 if $msg = $GUI_EVENT_CLOSE Or $msg = $exitbutton Then Exit
 if $msg = $browsebutton Then
  GUICtrlSetState($browsebutton,$GUI_DISABLE);
  GUICtrlSetData($browsebutton,"Searching...");
  $data = FileSelectFolder("Select folder","",2,"::{20D04FE0-3AEA-1069-A2D8-08002B30309D}")
  if $data <> "" Then
   GUICtrlSetData($input,$data);
   GUICtrlSetData($browsebutton,"Browse");
   GUICtrlSetState($browsebutton,$GUI_ENABLE);
  Else
   GUICtrlSetData($input,"canceled...");
   GUICtrlSetData($browsebutton,"Browse");
   GUICtrlSetState($browsebutton,$GUI_ENABLE);
  EndIf
 EndIf
 if $msg = $settingbutton Then
$ChildWin = GUICreate("Child GUI", 100,200, $ParentWin_Pos[0] + 100, $ParentWin_Pos[1] + 100, -1, -1, $gui)
GUISetState(@SW_SHOW)

 EndIf

WEnd

Share this post


Link to post
Share on other sites

or even this

#include <GUIConstants.au3>
$gui = GUICreate("Read Movie files",225,64,default,default);
$ParentWin_Pos = WinGetPos($gui, "")
$input = GUICtrlCreateInput("",8,10,160)
$browsebutton = GUICtrlCreateButton("&Browse",173,10,46,20);
$settingbutton = GUICtrlCreateButton("&Settings",8,35,46,20);
$exitbutton = GUICtrlCreateButton("&Exit",173,35,46,20);
GUISetState(@SW_SHOW)

$msg = 0
While $msg <> $GUI_EVENT_CLOSE
$msg = GUIGetMsg()
Select
    
  Case $msg = $browsebutton
      GUICtrlSetState($browsebutton,$GUI_DISABLE);
      GUICtrlSetData($browsebutton,"Searching...");
      $data = FileSelectFolder("Select folder","",2,"::{20D04FE0-3AEA-1069-A2D8-08002B30309D}")
      if $data <> "" Then
         GUICtrlSetData($input,$data);
         GUICtrlSetData($browsebutton,"Browse");
         GUICtrlSetState($browsebutton,$GUI_ENABLE);
      Else
         GUICtrlSetData($input,"canceled...");
         GUICtrlSetData($browsebutton,"Browse");
         GUICtrlSetState($browsebutton,$GUI_ENABLE);
      EndIf
 
   Case $msg = $settingbutton 
      $ChildWin = GUICreate("Child GUI", 100,200, $ParentWin_Pos[0] + 100, $ParentWin_Pos[1] + 100, -1, -1, $gui)
      GUISetState(@SW_SHOW)
      While 1
          $msg = GUIGetMsg()
          
           If $msg = $GUI_EVENT_CLOSE then
                  GUIDelete($ChildWin)
                  Exitloop
              EndIf
     WEnd
EndSelect
WEnd

Share this post


Link to post
Share on other sites

:) thnx

got it working now..

i also tried it on that way but i always got an error...

too bad i cant compare now ;)

ah well it works, now i just need to fill the child window, wich is easy ;)

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  
Followers 0