Page 1 of 1

urgent help with 'if' statement!

Posted: 04 Nov 2012, 23:22
by MarkyBoy
Hi all, I'm really close to fixing this one but I just can't seem to get it!
I have a list of values and for each value selected I want to show a particular image, so I can do it for the first item like this:
If "TextBox3" Is First Item Selected
Show Objet "image1"
But there are no options to then have for example:
If "TextBox3" Is Second Item Selected
Show Object "image2"
I tried to use an expression but got a message sayine 'Seledted variable not defined'
How do I do this simple action?!

urgent help with 'if' statement!

Posted: 05 Nov 2012, 01:31
by Matthias Guenther (Quark)
Hi mark,
if you get the error "variable not defined" then you used a name that is not known elsewhere. E.g. a typo in a text box name.
Thanks
Matthias

urgent help with 'if' statement!

Posted: 05 Nov 2012, 03:28
by MarkyBoy
Thanks MatthiasIt's the 'selected' variable that Quark says is not defined, so I enter an expression that says:If"TextBox3" Is Second Item SelectedI immediately get a message saying the 'selected' variable is not defined.What do you think?

urgent help with 'if' statement!

Posted: 06 Nov 2012, 22:23
by Matthias Guenther (Quark)
Hi Mark,
when you use expressions you need to use the methods that are supported, so only the ones that are listed in the Expression Editor.
To find out what text is selected, the expression "TextBoxName.GetSelectedText()" should work.
Thanks
Matthias

urgent help with 'if' statement!

Posted: 07 Nov 2012, 00:19
by MarkyBoy
Thanks Matthias
I do not see the GetSelectedText command in the list in the expression editor, so I typed it in and it was accepted, however I have something wrong in the script, that I can't figure out why it does not work, I have the following:
Select Text "TextBox7", All
If Textbox7.GetSelectedText()="K"
Show Object "Test"
End If
Then assigned this script to an object with an event to run the script, but nothing happens! Any suggestions?

urgent help with 'if' statement!

Posted: 07 Nov 2012, 05:18
by MarkyBoy
Okay, I got it working by using the following:
Select Text "TextBox7", All
TextBox6.GetSelectedText()==="K"
Show Object "Test"
End If
My next question is whether I can add letters to the if statement so that if TextBox7 shows "J" then also show object "Test" or do I need to make a separate statement for each one?