Status of Checkbox Button for if... then...
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Status of Checkbox Button for if... then...
Hi,
I'm an absolute beginner to this and I wonder if there is a chance to use the status of a checkbox for a if .. then.. operation.
Example:
if button "checkbox" is checked then answer "Hello World"
else if button "checkbox" is unchecked then answer "No Hello"
I've thested a hundret possible expressions but didn't find a working one.
Is it possible? How?
Looking foreward to answers.
Regards,
Taz
I'm an absolute beginner to this and I wonder if there is a chance to use the status of a checkbox for a if .. then.. operation.
Example:
if button "checkbox" is checked then answer "Hello World"
else if button "checkbox" is unchecked then answer "No Hello"
I've thested a hundret possible expressions but didn't find a working one.
Is it possible? How?
Looking foreward to answers.
Regards,
Taz
Hi Taz, this should do the trick:
Code: Select all
if the hilite of button "checkboxname" then
answer "hello world"
-- "... is true" is implied, you can, for the sake of legibility use:
-- "if the hilite of button "checkboxname" is true then"...
else
answer "the box is not checked" --(read: the hilite of button "checkboxname" is false)
end if
Is there an equivalent in Revolution to "c = c +1"
As some of you know, in other basic languages the programmer can use: c = c +1 as a counter. I'm sure all of you who are good at programming in Revolution are annoyed when "newbies" ask dumb questions. I'm a newbie to Revolution. It's pretty different than Visual Basic for example. Is there an equivalent. I'm trying to input numbers into a dialog box and have the number inputted appear in a text field and the running balance along side. Any suggestions?
I can't seem to find a site that has good examples of the syntax. The dictionary in Revolution is somewhat helpful, but it doesn't have good examples. The only way I learn this stuff is to see the code, so if anyone knows of other sites I'd appreciate a reply. Any help greatly appreciated
I can't seem to find a site that has good examples of the syntax. The dictionary in Revolution is somewhat helpful, but it doesn't have good examples. The only way I learn this stuff is to see the code, so if anyone knows of other sites I'd appreciate a reply. Any help greatly appreciated
urbaud
Re: Is there an equivalent in Revolution to "c = c +1&q
I'm very very new at this (started yesterday pretty much) but heres a couple examples that are close to what you want.
put 10 in temp
add 10 to temp
temp has 20 now.
Not quite as shorthand as the other method, but pretty short.
I didn't try it, but suspect if you didn't initialize a value for temp the add would still work just starting at 0, but i'm paranoid about things like that so always initialize values.
I suspect similar can be done directly in a field, but haven't tried it yet, like I say i'm very new. (started yesterday)
something like
put 10 into fld "fieldname"
add 10 to fld "fieldname"..
sec gonna try it.
Yep, works. I did this with a button and 2 fields.
on mouseUp
put 10 into fld "nextNum"
add fld "nextNum" to fld "runningTotal"
end mouseUp
That also could say
add 10 to fld "nextNum" rather than using 2 fields.
I'm sure you've already figured out how to do what you want, but answering helps me get a better handle on things so, there ya go.
put 10 in temp
add 10 to temp
temp has 20 now.
Not quite as shorthand as the other method, but pretty short.
I didn't try it, but suspect if you didn't initialize a value for temp the add would still work just starting at 0, but i'm paranoid about things like that so always initialize values.
I suspect similar can be done directly in a field, but haven't tried it yet, like I say i'm very new. (started yesterday)
something like
put 10 into fld "fieldname"
add 10 to fld "fieldname"..
sec gonna try it.
Yep, works. I did this with a button and 2 fields.
on mouseUp
put 10 into fld "nextNum"
add fld "nextNum" to fld "runningTotal"
end mouseUp
That also could say
add 10 to fld "nextNum" rather than using 2 fields.
I'm sure you've already figured out how to do what you want, but answering helps me get a better handle on things so, there ya go.
urbaud wrote:As some of you know, in other basic languages the programmer can use: c = c +1 as a counter. I'm sure all of you who are good at programming in Revolution are annoyed when "newbies" ask dumb questions. I'm a newbie to Revolution. It's pretty different than Visual Basic for example. Is there an equivalent. I'm trying to input numbers into a dialog box and have the number inputted appear in a text field and the running balance along side. Any suggestions?
I can't seem to find a site that has good examples of the syntax. The dictionary in Revolution is somewhat helpful, but it doesn't have good examples. The only way I learn this stuff is to see the code, so if anyone knows of other sites I'd appreciate a reply. Any help greatly appreciated
how about:
Code: Select all
put theVar + 10 into theVar
Various teststacks and stuff:
http://bjoernke.com
Chat with other RunRev developers:
chat.freenode.net:6666 #livecode
http://bjoernke.com
Chat with other RunRev developers:
chat.freenode.net:6666 #livecode
Hi Sturgis,
Thank you for your reply and suggestions. You were right I was able to figure it out on my own. Here's my script:
on mouseUp
put empty into field "text1" --clears textbox
put empty into field "text2" --clears textbox
wait 1 second --waits a second to show that textboxes are actually cleared
repeat with count = 1 to 10 --sets up the repeat command
put count into line count of field "text1" --numbers 1-10 displayed in textbox1
add count to c --math to create running total
put c into line count of field "text2" --running total displayed in textbox2
end repeat
end mouseUp
Urbaud
Thank you for your reply and suggestions. You were right I was able to figure it out on my own. Here's my script:
on mouseUp
put empty into field "text1" --clears textbox
put empty into field "text2" --clears textbox
wait 1 second --waits a second to show that textboxes are actually cleared
repeat with count = 1 to 10 --sets up the repeat command
put count into line count of field "text1" --numbers 1-10 displayed in textbox1
add count to c --math to create running total
put c into line count of field "text2" --running total displayed in textbox2
end repeat
end mouseUp
Urbaud
urbaud
Can't get this to work? Is it supposed to?
BvG wrote:how about:
Code: Select all
put theVar + 10 into theVar
yes it works... As long as the variable actually contains a number, of course.
Code: Select all
on mouseUp
put 1 into theVar
put theVar + 1 into theVar
put theVar
end mouseUp
Various teststacks and stuff:
http://bjoernke.com
Chat with other RunRev developers:
chat.freenode.net:6666 #livecode
http://bjoernke.com
Chat with other RunRev developers:
chat.freenode.net:6666 #livecode