Trying a custom handler for several math fields

Graham Samuel livfoss at mac.com
Fri Sep 13 12:23:40 EDT 2013


Hi Vaughn

Klaus beat me to it. You should understand that the message path looks after the passing of the message from the control on the card to the card itself. I mean any handler that calls 'doMath' in the control will rely on the engine to look for the definition of the handler, and if it isn't in the control, the next place it will look is the card. A 'pass' message isn't relevant here.

However, as Klaus says, there must be a way that your program triggers the action you require. If the control is a button, then a 'mouseup' handler will do it; if Klaus is right and it's just a field, then there must be an way to invoke 'doMath' when the focus leaves the field (for example) as he explains.

Graham

On 13 Sep 2013, at 18:17, Klaus major-k wrote:

> Hi Vaughn,
> 
> Am 13.09.2013 um 17:54 schrieb Vaughn Clement <vclement at gmail.com>:
> 
>> Hi All
>> 
>> Well my first attempt ever to use a custom handler (OK :- (
>> Well I thought I understood what to do, but as things go I didn't get the
>> expected result:
>> In the card control field,  I put this pass call;
>> 
>> on doMath
>>  pass doMath
>> end doMath
> 
> you need to TRIGGER this somehow, maybe "on closefield"?
> 
> on closefield
>  doMath
> end closefield
> 
> Try this, it will work :-)
> 
> See below for other EVENTS that may trigger your doMath handler in a field
> 
>> in the card script I put this script;
>> 
>> on doMath
>>  put field "Loan Balance 1" + field "Loan Balance 2" into field "Loan
>> Balance Total"
>>  -- set the numberFormat to "#.00" -- dollar format testing to see if it
>> worked "No"
>> end doMath
> 
> Correct!
> 
>> The fields both had the pass call to send the math to the card handler.
> 
> See above, do not PASS, just "EVOKE" the handler when something happens, 
> like RETUNRIFIELD, ENTERINFIELD or CLOSEFIELD.
> 
> Otherwise nothing will happen, EVER! ;-)
> 
>> Thank you
>> 
>> Vaughn Clement
> 
> Best
> 
> Klaus
> 
> --
> Klaus Major
> http://www.major-k.de
> klaus at major-k.de
> 
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list