AutoHotkey Community

It is currently May 27th, 2012, 12:38 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 11 posts ] 
Author Message
 Post subject: gui problem
PostPosted: January 22nd, 2010, 10:06 am 
Offline

Joined: November 9th, 2009, 3:09 pm
Posts: 258
Hello everyone i have created a gui which has several controls like buttons,radio,checkboxes…etc In my gui I have added three functionalities like View settings,Restore Previous settings and Reset previous settings.

View Settings:-Opens a .ini file where it gives the information to the user about which controls are selected for e.g if radio is check then in the .ini file it writes 1 in front of that radio name.

Restore Previous Settings:-When the user opens the gui and if he presses this button then the previous done settings will be uploaded and the control will get selected.
Basically it reads from the .ini file and uploads the control.
IniRead,output,%A_ScriptDir%\Configuration.ini,Main,Offline test
Guicontrolget,Offline
guicontrol,,Offline,%output%

Reset:-It will write 0 in front of all control names in the .ini file and will upload the gui with default settings(all controls 0)
IniWrite,0,%A_ScriptDir%\Configuration.ini,Main,Offline test
Send !{R} ;;;;;;clicks the button Restore Previous Settings

Uptil now everything works fine but now when I added a button "Open"on a gui which opens a new small gui 2 window which also have some controls. When I click any one control on it then it writes 1 in the .ini file but the moment when I click restore or reset it works fine on the gui 1 but not on the newly created gui 2 that is the small one it never reset or restore but it write 0 in the .ini file correctly then why its not uploading this new setting on the new gui?????

Please help me out….your help is always appreciated ...below is my .ini file
Code:
[Offline]
Command line Parameter '-n'=0

[AutoOffline]
Command line Parameter '-n'=0


here is a part of my code
Code:
Restore:
gui,1: submit,nohide
gui,2: submit

IniRead,output,%A_ScriptDir%\Configuration.ini,Offline,Command line Parameter '-n'
Guicontrolget,n
guicontrol,,n,%output% ; resores(1 or 0) properly on control present on gui1

IniRead,output,%A_ScriptDir%\Configuration.ini,AutoOffline,Command line Parameter '-n'
Guicontrolget,an
guicontrol,,an,%output% ; does not do anything no restore on the control present on gui2...why???

Return

Reset:
gui,1:submit,nohide
gui,2:submit

IniWrite,0,%A_ScriptDir%\Configuration.ini,Offline,Command line Parameter '-n' ; makes control 0 on gui1

IniWrite,0,%A_ScriptDir%\Configuration.ini,AutoOffline,Command line Parameter '-n' ; does not make the control 0 on gui2

send !{R} ;;;clicks the button "Restore Previous Settings"

in short is it possible to send controls to gui2 from gui1....like if i press a button on gui1 it should send the control on gui2 which is not on the screen????


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 22nd, 2010, 12:15 pm 
Offline

Joined: April 19th, 2005, 10:26 am
Posts: 2250
Location: switzerland
4th EDIT: examples with 2 GUI and a menu, menu can start with shortcut V C D W (when opened)

Code:
     ;--------------- SETTINGS ------------------
     menu ,S1 ,Add,&Volume     ,MH1
     menu ,S1 ,Add,&Charmap    ,MH2

     ;-------------- TOOLS ---------------------------
     Menu,S2,add,&DOS                   ,MH11
     Menu,S2,add,&Wininfo               ,MH12
     menu, myMenuBar, Add, Settings      ,:S1
     menu, myMenuBar, Add, Tools         ,:S2

gui,2:menu,MyMenuBar
;----------------------------------------------------

  Gui, 2:Font,  S10 CDefault, FixedSys
  Gui, 2:Add,Text, x1  y5 w80  h20, NAME
  Gui, 2:Add,Edit, x60 y5 w140 h20 vA31, %A31%
  Gui, 2:Add,Text, x1  y35 w80  h20, Phone
  Gui, 2:Add,Edit, x60 y35 w140 h20 vA32, %A32%
  Gui, 2:Add,Edit, x60 y65 w200 h20 vA33 readonly,
  Gui, 2:Add, Button, x330 y95 w40 h25 gStart1, OK
  Gui, 2:Add, Button, x220 y95 w70 h25 gVOL, VOLUME
  Gui, 2:Add, Button, x100 y95 w70 h25 g2nd, GUI99
  Gui, 2:Show, x0 y0 w380 h120, NAME-INPUT
  GuiControl, 2:Focus, A31
return

VOL:
run,sndvol32
return

MH1:
run,sndvol32
return

MH2:
run,charmap
return

MH11:
C2=C:\WINDOWS\hh.exe ms-its:C:\WINDOWS\Help\ntcmds.chm::/ntcmds.htm
run,%C2%
return

MH12:
run,winver
return


2Guiclose:
gui,99:destroy
exitapp

Start1:
Gui,2:submit,nohide
GuiControl,2: ,A33,Name=%A31%   Phone=%A32%
;msgbox,Name=%A31%`nPhone=%A32%
return


2nd:
Gui,2:submit,nohide
Gui,99:+AlwaysOnTop
Gui,99:default
  Gui, 2:+Disabled
  Gui, 99:+Owner

  Gui,99:Add,Edit, x60 y5 w140 h20 vA35, %A35%
  Gui,99:Add,Text, x1  y35 w80  h20, Adress
  Gui,99:Add, Button, x220 y95 w70 h25 gVOL, VOLUME
  Gui,99:Add, Button, x330 y95 w40 h25 gOK99, OK
  Gui,99:Show, x400 y0 w380 h120, Adress
  GuiControl, 99:Focus, A35
return

99Guiclose:
Gui,2:-Disabled
Gui,2:default
gui,99:destroy
return


OK99:
Gui,99:submit,nohide
GuiControl,2: ,A33,%A35%
return

!s::
run,calc
return




Last edited by garry on January 22nd, 2010, 4:30 pm, edited 4 times in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 22nd, 2010, 12:28 pm 
Offline

Joined: November 9th, 2009, 3:09 pm
Posts: 258
thanks but i didnt meant that...as you can see in my above example i have two gui's 1 & 2 of which gui1 is the main gui and i have a button called restore on it. what i want is when i click Restore on gui1 then it should produce a change on gui2 which is not opened
for example change like text in the edit field of gui1 should appear in the text field of gui2 when i click the button which is present on gui1


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 22nd, 2010, 12:40 pm 
Offline

Joined: May 27th, 2007, 9:41 am
Posts: 4999
Did you try what garry said, specify the GUI in your example you don't
Code:
guicontrol,,an,%output% ; does not do anything no restore on the control present on gui2...why???
vs
Code:
GuiControl, 2:Focus, A31

_________________
AHK FAQ
TF : Text files & strings lib, TF Forum


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 22nd, 2010, 12:55 pm 
Offline

Joined: November 9th, 2009, 3:09 pm
Posts: 258
i did but it gives the error as "Parameter #3 must be blank in this case"
Specifically:%output%


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 22nd, 2010, 1:14 pm 
Offline

Joined: November 9th, 2009, 3:09 pm
Posts: 258
these are the following changes made but no change on gui2
Code:
Restore:
gui,1: submit,nohide
gui,2: submit

IniRead,output,%A_ScriptDir%\Configuration.ini,Offline,Command line Parameter '-n'
Guicontrolget,n
guicontrol,,n,%output%
IniRead,output,%A_ScriptDir%\Configuration.ini,AutoOffline,Command line Parameter '-n'
Guicontrolget,an
guicontrol,2:Focus,an,%output% ;;;gives error here with %output%
Return

Reset:
gui,1:submit,nohide
gui,2:submit

IniWrite,0,%A_ScriptDir%\Configuration.ini,Offline,Command line Parameter '-n'

IniWrite,0,%A_ScriptDir%\Configuration.ini,AutoOffline,Command line Parameter '-n'
send !{R} ;;;clicks the button "Restore Previous Settings"


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 22nd, 2010, 1:37 pm 
Offline

Joined: April 19th, 2005, 10:26 am
Posts: 2250
Location: switzerland
made above an example with 2 GUI


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 22nd, 2010, 2:07 pm 
Offline

Joined: November 9th, 2009, 3:09 pm
Posts: 258
Thank GOD....thanks man you really saved me i was working from morning and when i came to this problem i started to scratch my head a lot as i was not in a condition to take out bugs but thanks a million man...HATS OFF garry


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 22nd, 2010, 4:03 pm 
Offline

Joined: November 9th, 2009, 3:09 pm
Posts: 258
well how about clicking gui2 button from gui1 button??? with guicontrol we can check,uncheck,enable,disable...but how about clicking a button???
what i tried to do is
Code:
Guicontrolget,cl
guicontrol,3:,cl,!(s) ;;;;it changes the text of the button but what i want is it should press that button as !s is hotkey for that button

your help is always appreciated


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 22nd, 2010, 4:30 pm 
Offline

Joined: April 19th, 2005, 10:26 am
Posts: 2250
Location: switzerland
added script above a menu (when opened shortcuts with V C D W, and hotkey !s )
you can use the same gLabel in the new Gui which already exists (example gVOL )


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 25th, 2010, 9:55 am 
Offline

Joined: November 9th, 2009, 3:09 pm
Posts: 258
well thanks garry but in my case VOL of first gui and VOL of second gui perform different task. What i want is VOL button of gui1 performs several tasks and one of its task is of VOL from gui2. For example :-VOL button of gui 2 has run notepad.exe command and VOL is defined with a hotkey !V. VOL button of gui has several run condition and the order is suppose
Code:

VOL: ;;;;gui 1 button
gui,submit,nohide
Send !{V} ;;;call to gui two window button VOL
Run calc.exe
return

but it works when i try to call the functions....


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 11 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bing [Bot], chaosad, jrav and 22 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group