jumping among Mainstack and substacks isn't easy

Peter M. Brigham pmbrig at gmail.com
Tue Jun 19 14:44:48 EDT 2012


The mouseup message accepts one parameter, which is the number of the button pressed, normally 1 (left-click) or 3 (right-click). You can't pass other info along with the message, you have to build up your data inside the handler, as you in fact do with the stuff below that works.

On Jun 19, 2012, at 2:04 PM, Mark Rauterkus wrote:

> Hi,
> 
> Still here with newbie frustration and needing to move along.
> 
> So, ....
> 
> This works for me in a button.
> 
> on mouseUp tUserName
here tUserName probably contains "1" for left-click
>   put "Roberto Clemente" into tUserName
now you fill the variable with another value, the one you want
>   put "Present on" && the short english date & return after field
> "Attendance" of card tUserName of stack "Kids"
> end mouseUp
> 
> But this does NOT work, I guess, because I am wrongly building the
> tUserName so that tUserName is not valid in the script..
> 
> on mouseUp tUserName, tCharCount, tFirstName, tSecondName
here tUserName is probably "1" and the 3 following variables are empty -- mouseup only "understands" one parameter and it understands it as the identifier for the button pressed
>   get word 1 of field "Filtered_Results"
>   put it into tFirstName
>   get word 2 of field "Filtered_Results"
>   put it into tSecondName
>   put quote & tFirstName & space & tSecondName & quote into tUserName
now you fill tUserName with another value, replacing the "1", so the line below now gives what you want
> 
>   -- put tUserName into msg box -- Works fine, shows "Roberto Clemente"
> 
>   put "Present on" && the short english date & return after field
> "Attendance" of card tUserName of stack "Kids"
if you are getting an error here, then there is no card named "Roberto Clemente" -- maybe you named it "Clemente, Roberto"?
> 
> end mouseUp

Read the documentation on setting breakpoints, and set a breakpoint as the first line in your script. Then when you try to execute the script it will stop on the breakpoint and you can step through line by line and check the contents of your variables as you go. When code isn't working, this is the easiest (only?) way to debug it.

-- Peter

Peter M. Brigham
pmbrig at gmail.com
http://home.comcast.net/~pmbrig

PROGRAM, n. A series of instructions that tells a computer to turn
one's input into error messages.






More information about the use-livecode mailing list