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 

Help on Button question

 
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: Wed May 14, 2008 12:17 am    Post subject: Help on Button question Reply with quote

Hi folks,

Im getting some troubles to make de msg box appears:

Code:

;----------------manufacturer selection variables-------------

BrandChoice1 = |LG|Samsung|Phillips
BrandChoice2 = |Ford|Fiat|GM
BrandChoice3 = |HP|IBM|ASUS

;----------------tv screen size selection variables-----------

TVChoice1 = |19`"|21`"|29`"
TVChoice2 = |14`"|15`"|19`"
TVChoice3 = |29`"|32`"|40`"

;----------------car model selection variables----------------

CarChoice1 = |Fusion|Ka|Ecosport
CarChoice2 = |Uno|Punto|Idea
CarChoice3 = |Astra|Meriva|Vectra

;----------------computer model selection variables----------------

ComputerChoice1 = |Compaq|Pavilion|Pavilion Slimline
ComputerChoice2 = |Lenovo 3010|Lenovo 3020|Lenovo 4000
ComputerChoice3 = |Notebook W2V|Notebook W2JC|Notebook W2P

;----------------GUI------------------------------------------

Gui, Add, Text, x21 y9 w200 h16, Please select an item from the Wish List:
Gui, Add, ListBox, x21 y25 w200 h90 vProduct gWishList AltSubmit, Digital TV|Car|Computer ; select product type
;
Gui, Add, Text, x21 y114 w200 h16, Select a manufacturer:
Gui, Add, DropDownList, x21 y130 w200 vManufacturer gManufacturer AltSubmit, ; select manufacturer
;
Gui, Add, Text, x21 y159 w200 h16, Select a model:
Gui, Add, DropDownList, x21 y175 w200 vMake , ; select model
;
Gui, Add, Button, x21 y207 w100 h30 , Submit
Gui, Show, w242 h255
return


WishList:

Gui, Submit, NoHide
Choice := BrandChoice%product% ; establishes the manufacturer dropdown
GuiControl, , manufacturer, %choice% ; puts that dropdown in place
GuiControl, , Make, | ; empties the model dropdown in case it contains data
return

Manufacturer:

Gui, Submit, NoHide
if Product = 1 ; will run if Digital TV was chosen
{
  Model := TVChoice%Manufacturer%
  GuiControl, , Make, %Model%
  return
}
else if Product = 2 ; will run if Car was chosen
{
  Model := CarChoice%Manufacturer%
  GuiControl, , Make, %Model%
  return
}
else if Product = 3 ; will run if Computer was chosen
{
  Model := ComputerChoice%Manufacturer%
  GuiControl, , Make, %Model%
  return
}

ButtonSubmit: ; The button should bring messages only for options computer > ibm > lenovo..smthing

if Make = Lenovo 4000
{
MsgBox, Lenovo 4000 has chosen!!!
  Return
 }
 else if Make = Lenovo 3020
{
MsgBox, Lenovo 3020 has chosen!!!
  Return
}
  else if Make = Lenovo 3010
{
MsgBox, Lenovo 3010 has chosen!!!
  Return
}

 
GuiEscape:
GuiClose:
ExitApp


The application is closing and i get no msg box displayed. What am i doin wrong?
Back to top
View user's profile Send private message
Elesar



Joined: 28 Jun 2007
Posts: 91

PostPosted: Wed May 14, 2008 12:47 am    Post subject: Reply with quote

You need a return at the end of your if/else/then statement.

Right now, you have one for each msgbox, but after it choses one to display, it goes straight to your GuiClose/ExitApp statement.

EDIT:
Well, maybe not, now that I got a chance to check it, but I'll look at it some more in a bit, on my lunch break.

EDIT2:
There is a problem with your variable reassignment. I havn't figured it out quite yet, but I replaced your if/then statement with a msgbox that displayed the make variable(the one in your if/then), and if the first model is chosen, then you get the full list, if the second model is chosen, you get nothing.....look into how you are resigning the variable there.
Back to top
View user's profile Send private message
sinkfaze



Joined: 19 Mar 2008
Posts: 138

PostPosted: Wed May 14, 2008 2:26 am    Post subject: Reply with quote

Your button isn't submitting any information to make the message box appear:

Code:
ButtonSubmit:
Gui, Submit, NoHide
if Make = Lenovo 4000
{...


And your code for the button's function can be greatly simplified with a couple tweaks:

Code:
ButtonSubmit:
Gui, Submit, Nohide
IfInString, Make, Lenovo ; looks for the word Lenovo in the contents of the Make variable
{
 MsgBox, %Make% has been chosen!!! ; creates a message box including the contents of the Make variable
  return
}
else
{
 return
}

_________________
Have trouble searching the site for information? Try Quick Search for Autohotkey.
Back to top
View user's profile Send private message
macaddress



Joined: 29 Apr 2008
Posts: 20

PostPosted: Wed May 14, 2008 3:13 am    Post subject: Reply with quote

Hi Elesar.

Quote:
.....look into how you are resigning the variable there.


It seems like the reassignment was ok!!

And thank you sinkfaze.

Quote:
Your button isn't submitting any information to make the message box appear:


Itīs working now. Regarding the IfInString I will check on it!!!

Thank you guys!!!
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