Hi
New to LiveCode and loving it
I created a grid of buttons based on stored data.
How do I add code to each button (mouseUp)?
Alternatively, how can I detect which button was pressed on a stack?
Also, how can I get a stack to size smaller than a full ipad? Every stack or card I use resizes to full screeen
thanks in advance for your help
Steve
Adding Code to created buttons on iPad
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Re: Adding Code to created buttons on iPad
Hi Steve,
1. to detect the button that has been clicked, you can check "the target" in a generic "mouseup" handler in the card or stack script!
Stack script:
2. Although adding code to objects via scripts, this is not recommended, since there are runtime limitations for this!
You can only add/set scripts with a maximum of 10 statements in a standalone.
So a "generic" handler would suit better in this situation, or using and setting behaviours for newly created objects.
3. Stack size.
Since iOS apps are in fact "one window only" app, I am afraid it is not possible to have smaller sized stacks,
since there is no desktop or whatever on iDevices and thus you always get a fullscreen display.
Someone please correct me if I'm wrong.
Best
Klaus
1. to detect the button that has been clicked, you can check "the target" in a generic "mouseup" handler in the card or stack script!
Stack script:
Code: Select all
on mouseup
put the name of the target into tTarget
put the short name of the target into tTargetName
## will be something line: buton "mybutton1" or filed "name of field"
## We only want check for buttons:
if word i oftTaget <> "button" then
exit mouseup
end if
## Now we can "react" on the different bvutons clicked:
switch tTargetName
case "button666"
## do yourt thing with this button
break
case "button 555"
### etc.
break
end switch
end mouseup
You can only add/set scripts with a maximum of 10 statements in a standalone.
So a "generic" handler would suit better in this situation, or using and setting behaviours for newly created objects.
3. Stack size.
Since iOS apps are in fact "one window only" app, I am afraid it is not possible to have smaller sized stacks,
since there is no desktop or whatever on iDevices and thus you always get a fullscreen display.
Someone please correct me if I'm wrong.
Best
Klaus