AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Var calls with Gui control [ RESOLVED - TANX FOR HELP]

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
macaddress



Joined: 29 Apr 2008
Posts: 20

PostPosted: Tue Apr 29, 2008 11:07 pm    Post subject: Var calls with Gui control [ RESOLVED - TANX FOR HELP] Reply with quote

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
View user's profile Send private message
engunneer



Joined: 30 Aug 2005
Posts: 6847
Location: Pacific Northwest, US

PostPosted: Tue Apr 29, 2008 11:21 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
macaddress



Joined: 29 Apr 2008
Posts: 20

PostPosted: Tue Apr 29, 2008 11:33 pm    Post subject: Reply with quote

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.

Wink
Back to top
View user's profile Send private message
Zed Gecko



Joined: 23 Sep 2006
Posts: 101

PostPosted: Wed Apr 30, 2008 1:32 am    Post subject: Reply with quote

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 Smile
Back to top
View user's profile Send private message
macaddress



Joined: 29 Apr 2008
Posts: 20

PostPosted: Wed Apr 30, 2008 1:56 am    Post subject: Reply with quote

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 Rolling Eyes

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.

Surprised
Back to top
View user's profile Send private message
Zed Gecko



Joined: 23 Sep 2006
Posts: 101

PostPosted: Wed Apr 30, 2008 2:14 am    Post subject: Reply with quote

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
View user's profile Send private message
macaddress



Joined: 29 Apr 2008
Posts: 20

PostPosted: Wed Apr 30, 2008 8:43 pm    Post subject: Reply with quote

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
View user's profile Send private message
macaddress



Joined: 29 Apr 2008
Posts: 20

PostPosted: Thu May 01, 2008 1:27 am    Post subject: Reply with quote

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
View user's profile Send private message
macaddress



Joined: 29 Apr 2008
Posts: 20

PostPosted: Thu May 01, 2008 1:38 pm    Post subject: Reply with quote

Hi guys!!!

Would someone please answer my question? I know that one must be piece of cake for most of you guys Wink

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
View user's profile Send private message
macaddress



Joined: 29 Apr 2008
Posts: 20

PostPosted: Thu May 01, 2008 5:57 pm    Post subject: Reply with quote

tANX FOR ALL!!!

SOMETIMES WE JUST NEED TO THINK A LITTLE BIT MORE BEFORE ASKING FOR HELP!!!

REGARDS FOR ALL!!!!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group