 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
macaddress
Joined: 29 Apr 2008 Posts: 20
|
Posted: Tue Apr 29, 2008 11:07 pm Post subject: Var calls with Gui control [ RESOLVED - TANX FOR HELP] |
|
|
Hi folks!!!
I´m trying to do a simple task that will be the basis for development of my work. Here is a sample of the code i wrote with te basic idea of what i was working on:
| Code: |
Gui, Add, ListBox, x26 y47 w170 h90 vchoice1 gUpdate1, CAR|COMPUTER|DIGITAL_TV
Gui, Add, GroupBox, x16 y17 w190 h180 , WISH LIST
Gui, Show, x486 y410 h219 w229, WISH LIST
return
Update1:
If Assignment = CAR
{
Gosub CAR
}
Else if Assignment = COMPUTER
{
Gosub COMPUTER
}
Else if Assignment = DIGITAL_TV
{
Gosub DIGITAL_TV
}
CAR:
Gui, Add, DropDownList, x105 y107 w200 , FORD|FIAT|GM
Gui, Add, GroupBox, x75 y19 w260 h180 , MANUFACTURER SELECTION
Gui, Show, x140 y97 h221 w412, MANUFACTURER SELECTION
Return
COMPUTER:
Gui, Add, DropDownList, x105 y107 w200 , HP|IBM|ASUS
Gui, Add, GroupBox, x75 y19 w260 h180 , MANUFACTURER SELECTION
Gui, Show, x140 y97 h221 w412, MANUFACTURER SELECTION
Return
DIGITAL_TV:
Gui, Add, DropDownList, x105 y107 w200 , LG|SAMSUNG|PHILIPS
Gui, Add, GroupBox, x75 y19 w260 h180 , MANUFACTURER SELECTION
Gui, Show, x140 y97 h221 w412, MANUFACTURER SELECTION
Return
GuiClose:
ExitApp
Return
|
The questions are:
How to make the screen "manufacturer selection" apears in another gui (this is not happening) and how to make this screen updated according to the selection made on the "wishlist screen" even before a new gui is already triggered.
Sorry for the noob question, but i started from scratch a few days ago.
By the way this is an amazing tool!!! Congratz to the Author!!![/list]
Last edited by macaddress on Thu May 01, 2008 5:57 pm; edited 2 times in total |
|
| Back to top |
|
 |
engunneer
Joined: 30 Aug 2005 Posts: 6847 Location: Pacific Northwest, US
|
Posted: Tue Apr 29, 2008 11:21 pm Post subject: |
|
|
you can start a second Gui, by replacing Gui, Add with Gui, 2:Add.
It may be more userfriendly to keep everything in one GUI, and using commands like GuiControl to change the values in subsequent gui elements. _________________
Unless otherwise noted, all code is untested.
Common Answers: 1.(Loops, Viruses, etc.) 2. Search 3.RTFM |
|
| Back to top |
|
 |
macaddress
Joined: 29 Apr 2008 Posts: 20
|
Posted: Tue Apr 29, 2008 11:33 pm Post subject: |
|
|
Tnx engunner, the issue with a new GUI is solved, but somethig else is wrong now, no matter what choice i pick on the wishlist menu, the new GUI always shows me the options on the dropdownlist from the "CAR" subroutine.
Regarding the sugestion for keeping all in one GUI, i agree with you. But i had some hard times trying to figure out how to do it, since the first menu must be always available. If you could change my script to any sugestion of yours i would apreciate.
 |
|
| Back to top |
|
 |
Zed Gecko
Joined: 23 Sep 2006 Posts: 101
|
Posted: Wed Apr 30, 2008 1:32 am Post subject: |
|
|
ist the script you posted everything??
Cause it hase neither a Gui, Submit line
nor does it use the same Var for ListBox and If-Statement.
And each of which would prevent the desired action  |
|
| Back to top |
|
 |
macaddress
Joined: 29 Apr 2008 Posts: 20
|
Posted: Wed Apr 30, 2008 1:56 am Post subject: |
|
|
Hi Zed
I´ve corrected the variable issue but the trouble still stand.
About the Gui submit: i believe that is not necessary because of the gUpdate, so anytime i click on a listbox item it triggers the second gui again. Thats what i figured out about the gUpdate
Follows the code with the corrections:
| Code: |
Gui, Add, ListBox, x26 y47 w170 h90 vchoice1 gUpdate1, CAR|COMPUTER|DIGITAL_TV
Gui, Add, GroupBox, x16 y17 w190 h180 , WISH LIST
Gui, Show, x486 y410 h219 w229, WISH LIST
return
Update1:
If choice1 = CAR
{
Gosub CAR
}
Else if choice1 = COMPUTER
{
Gosub COMPUTER
}
Else if choice1 = DIGITAL_TV
{
Gosub DIGITAL_TV
}
COMPUTER:
Gui, 2:Add, DropDownList, x105 y107 w200 , HP|IBM|ASUS
Gui, 2:Add, GroupBox, x75 y19 w260 h180 , MANUFACTURER SELECTION
Gui, 2:Show, x140 y97 h221 w412, MANUFACTURER SELECTION
Return
DIGITAL_TV:
Gui, 2:Add, DropDownList, x105 y107 w200 , LG|SAMSUNG|PHILIPS
Gui, 2:Add, GroupBox, x75 y19 w260 h180 , MANUFACTURER SELECTION
Gui, 2:Show, x140 y97 h221 w412, MANUFACTURER SELECTION
Return
CAR:
Gui, 2:Add, DropDownList, x105 y107 w200 , FORD|FIAT|GM
Gui, 2:Add, GroupBox, x75 y19 w260 h180 , MANUFACTURER SELECTION
Gui, 2:Show, x140 y97 h221 w412, MANUFACTURER SELECTION
Return
GuiClose:
ExitApp
|
That was the way i found to get the task done. I may be wrong, of course.
If you have another guess about it i would appreciate if you let me know.
 |
|
| Back to top |
|
 |
Zed Gecko
Joined: 23 Sep 2006 Posts: 101
|
Posted: Wed Apr 30, 2008 2:14 am Post subject: |
|
|
I´m sorry, but you´re wrong about Gui, Submit!
You really really need it.
Gui, Submit will fill the choice1 Var with the selected listbox item. Without it stays empty, or at least unchanged.
check out: http://www.autohotkey.com/docs/commands/Gui.htm#Submit
regarding your "adding different listboxes to the Gui" issue
i strongly suggest, to add just one more Listbox to the Gui
and fill it with different contents depending on the chice you made using GuiControl
here is a little example: | Code: | WISHLIST = |CAR|COMPUTER|DIGITAL_TV
CAR = |FORD|FIAT|GM
COMPUTER = |LG|SAMSUNG|PHILIPS
DIGITAL_TV = |HP|IBM|ASUS
Gui, Add, ListBox, x26 y10 w200 h90 vchoice1 gUpdate1,
Gui, Add, DropDownList, x26 y110 w200 vchoice2 Disabled,
Gui, Show
GuiControl, , choice1, %WISHLIST%
return
Update1:
Gui, Submit, NoHide
GuiControl,Enable , choice2
new_content := %choice1%
GuiControl, , choice2, %new_content%
return |
|
|
| Back to top |
|
 |
macaddress
Joined: 29 Apr 2008 Posts: 20
|
Posted: Wed Apr 30, 2008 8:43 pm Post subject: |
|
|
Txn Zed!!
I got the basic idea of what i was searching for. I ll go over some studies on gui submit to understand it completely (its function is not clearly for me yet).
Best Regards for all!!! |
|
| Back to top |
|
 |
macaddress
Joined: 29 Apr 2008 Posts: 20
|
Posted: Thu May 01, 2008 1:27 am Post subject: |
|
|
Hi Zed,
There's something driving me nuts about your example. What have you done for the VARS (below) apear in the DDM if you did not make any reference for them in the code?
CAR = |FORD|FIAT|GM
COMPUTER = |LG|SAMSUNG|PHILIPS
DIGITAL_TV = |HP|IBM|ASUS
I had read about GuiControl and Gui, Submit in the hotkey help, but i didn't get it yet. Could you provide me a clearly expanation abou it, using the example as model?
Sorry if im asking too much, but im new to this stuff. I work with computer networking and Telecoms, so im trying to learn some new tricks to help me with my routines at work. |
|
| Back to top |
|
 |
macaddress
Joined: 29 Apr 2008 Posts: 20
|
Posted: Thu May 01, 2008 1:38 pm Post subject: |
|
|
Hi guys!!!
Would someone please answer my question? I know that one must be piece of cake for most of you guys
I'm in a hurry to finish my script and this answer is all that i need to get the job done.
Best Regards. |
|
| Back to top |
|
 |
macaddress
Joined: 29 Apr 2008 Posts: 20
|
Posted: Thu May 01, 2008 5:57 pm Post subject: |
|
|
tANX FOR ALL!!!
SOMETIMES WE JUST NEED TO THINK A LITTLE BIT MORE BEFORE ASKING FOR HELP!!!
REGARDS FOR ALL!!!! |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|