sharedscripts

Rob Meijer robmeyer at hetnet.nl
Thu Feb 24 16:38:29 EST 2005


Hi Jaqueline
Thanks a lot.
I did something of that, but stead buttons I use
one variable "scriptflag".
In every buttonscript the scriptflag corresponds with
a handler in the stacskcript.
The script in the field is:

global scriptflag
on mouseUp
if scriptflag="gocard" then
send gocard
else if scriptflag=.....
send...
else if scriptflag=.....
send...
end if
end mouseUp

So, thanks to Klaus Major, I am out of this problem,
waiting for the next one.

Every day I find astonishing things in Rev and I wonder
how Toolbook can exist without these statements.
Every day I find astonishing things in Rev and I wonder
why Rev did not copy them from Toolbook.

Thanks for your attention.
Rob

----------

At 20:13 24/2/2005, J. Landman Gay wrote:
>On 2/24/05 12:43 AM, Rob Meijer wrote:
>
>>Your suggestion to use "set the script of fld "content" to the script of 
>>btn "wijzigen"
>>was the first statement I tried. I put it as last statment into a 
>>handler, but got
>>the errormessage that a script cannot be altered while running.
>>Then I tried "send foo", foo being a handler in de stackscript. Same 
>>errormessage,
>>because what I need is not to execute handler "foo", but to replace the 
>>script of a field.
>>Example.
>>1.
>>The listfield is an index. Clicking a line opens a card:
>>on mouseup;get selectedtext;go card it
>>2.
>>A button is pressed to get a new script into that field.
>>Now that field may delete a card.
>>Or a button is pressed to get a new script into that field.
>>Now that field may change the content of a card.
>>3.
>>Here comes the problem:
>>The main task of the listfield is being an index to go to a card.
>>So I need a statement on the end of each script to reset the script
>>of that listfield to "on mouseup;get selectedtext;go card it".
>>This is easily done in Toolbook, but I can't find it in Transscript.
>
>This isn't how we usually do it in Revolution. In general, scripts 
>themselves are rarely changed, and in fact, if you compile a stack into a 
>standalone there are strict limits on replacing scripts so it isn't a 
>practical approach.
>
>Instead, the scripts should be unchanging and branch to the correct 
>behavior instead of trying to replace themselves. This allows one script 
>to handle all circumstances. It is also much easier than replacing the 
>script content.
>
>Do something like this instead:
>
>Set up three radio buttons, one for "go card", another for "delete card" 
>and a third for "change contents". Group them. This ensures that only one 
>can be hilited at a time. Then your field script should do this:
>
>on mouseUp
>  put the selectedtext of me into theCd
>  if the hilite of btn "go card" then
>    go card theCd
>  else if the hilite of btn "delete card" then
>    delete card theCd
>  else if the hilite of btn "change contents" then
>    -- do whatever you need here
>  end if
>end mouseUp
>
>One script handles everything. If your actions are lengthy, you can call 
>another handler instead of putting the commands directly into the 
>"mouseup" handler, like this:
>
>  ...
>  else if the hilite of btn "change contents" then
>    doCardChanges theCd
>  end if
>  ...
>
>on doCardChanges theCd
>   -- do stuff here to card theCd
>end doCardChanges
>
>--
>Jacqueline Landman Gay         |     jacque at hyperactivesw.com
>HyperActive Software           |     http://www.hyperactivesw.com
>_______________________________________________
>use-revolution mailing list
>use-revolution at lists.runrev.com
>http://lists.runrev.com/mailman/listinfo/use-revolution

robmeyer at hetnet.nl
www.japrosoft.com
no more spam: Mailwasher Pro
http://www.firetrust.com/products/pro/
and please mention my emailaddress...  


More information about the Use-livecode mailing list