Answer dialog enhancement...

Paul Dupuis paul at researchware.com
Tue Mar 31 20:23:34 EDT 2020


On 3/31/2020 7:12 PM, Bob Sneidar via use-livecode wrote:
> Seems like most if not all this code has been done already in the dialog itself. I’ll look into it because I wanted at one point to make an enhanced answer dialog as well.
>
> Bob S

I'm thinking that if I need to roll my own, then my approach might be to 
write a handler that adds or removes the button by script from the 
standard Answer Dialog. That was if LC Corporate every makes changed to 
the dialog, your project inherits them with a new built under a new 
version of the engine.

If you copy the dialog, then you either need to rename it and maintain 
it or do manual Inclusions and exclude the engine from conflicting with 
your copy.

I was thinking something like:

on mouseUp
   dontaskagain "on","Do not show this message again."
   answer warning "Some message I may not want to see again." with 
"Cancel" or "OK" titled "A Message"
   put it into tAnswer
   dontaskagain "off"
end mouseUp

command dontaskagain pActivate, pLabel
   -- usage:
   -- dontaskagain "on|off" [, <some label>]
   --   dontaskagain "on","Do not show this message again."
   --   answer warning "Some message I may not want to see again." with 
"Cancel" or "OK" titled "A Message"
   --   put it into tAnswer
   --   dontaskagain "off"

   switch pActivate
     case "on"
       -- setup the templateButton
       set the style of the templateButton to "checkbox"
       set the label of the templateButton to pLabel
       set the width of the templateButton to the formattedWidth of the 
templateButton
       set the height of the templateButton to 23
       --
       create btn "DontAskAgain" in cd 1 of stack "Answer Dialog"
       --
       reset the templateButton
       break
     case "off"
       delete btn "DontAskAgain" of cd 1 of stack "Answer Dialog"
       break
   end switch
end dontaskagain

This adds the checkbox or removes it to the built in Answer Dialog 
dynamically. The problem is pre-positioning the checkbox. The dialog has 
a preOpenCard handler that does the position and if I position it ahead 
of time the code it the preOpenCard changes things

I think I need to insert a openCard handler into the stack dynamically, 
which would execute after preOpenCard, that positions the check box OR

attach a behavior script with an "after preOpenCard" handler, but I 
don't understand exactly how to do that??






More information about the use-livecode mailing list