Hi All,
Is there a way to add a btn "don't show this dialog again" to ask stack ?
I tried to modify ask stack but I can't do it.
Best regards
Jean-Marc
add a btn "don't show this dialog again" to ask stack
Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller
add a btn "don't show this dialog again" to ask stack
https://alternatic.ch
-
richmond62
- Livecode Opensource Backer

- Posts: 10528
- Joined: Fri Feb 19, 2010 10:17 am
Re: add a btn "don't show this dialog again" to ask stack
Personally I'd use a modified substack.
-
paul@researchware.com
- VIP Livecode Opensource Backer

- Posts: 155
- Joined: Wed Aug 26, 2009 7:42 pm
- Contact:
Re: add a btn "don't show this dialog again" to ask stack
This allows dynamic adding of a "Don't Show Again" check box to the ANSWER dialog. There is an example of its use, 2 routines that (1) show or hide the checkbox and (2) get the setting of the checkbox, and a behavior script that changes sets up the checkbox when the ASNWER dialog is opened.
Example
dontaskagain "on" -- add the "Don't Ask Again" check box to the asnwer dialog
put "<p><b>Prompt</b></p>" into tPrompt
answer warning tPrompt with "Learn More" or "Continue" titled "Some Title"
put it into tAnswer
put dontaskstatus() into tDontAskAgain
dontaskagain "off"
Rountines
command dontAskAgain pActivate
switch pActivate
case "on"
set the behavior of cd 1 of stack "Answer Dialog" to the long id of btn "DontAskBehavior" of stack "libHrGUI"
break
case "off"
set the behavior of cd 1 of stack "Answer Dialog" to empty
delete btn "DontAskAgain" of cd 1 of stack "Answer Dialog"
break
end switch
end dontAskAgain
function dontAskStatus
if exists(btn "DontAskAgain" of cd 1 of stack "Answer Dialog") then
put the hilite of btn "DontAskAgain" of cd 1 of stack "Answer Dialog" into tDontAskAgain
return tDontAskAgain
else
return false
end if
end dontAskStatus
Script of btn "DontAskBehavior" of stack "libHrGUI"
-- This behavior script is used in conjunction with the handlers in the library (stack) script called:
-- command dontaskagain pActivate where pActivate is [on|off] i.e. dontaskahain "on" or dontaskagain "off"
-- function dontaskstatus i.e. put dontaskstatus() produces true|false
--
-- usage is in conjunction with the answer command. example:
-- dontaskagain "on"
-- answer warning "Some message I may not want to see again." with "Cancel" or "OK" titled "A Message"
-- put it into tAnswer
-- put dontaskstatus() into tDontAskAgain
-- dontaskagain "off"
-- put "Don't Ask is:"&&tDontAskAgain &&"And button clicked is:"&&tAnswer
after preOpenCard
if exists(btn "DontAskAgain" of cd 1 of stack "Answer Dialog") then
set the style of btn "DontAskAgain" of cd 1 of stack "Answer Dialog" to "checkbox"
set the autoHilite of btn "DontAskAgain" of cd 1 of stack "Answer Dialog" to false
set the opaque of btn "DontAskAgain" of cd 1 of stack "Answer Dialog" to false
set the threeD of btn "DontAskAgain" of cd 1 of stack "Answer Dialog" to false
set the showBorder of btn "DontAskAgain" of cd 1 of stack "Answer Dialog" to false
set the hiliteBorder of btn "DontAskAgain" of cd 1 of stack "Answer Dialog" to false
set the height of btn "DontAskAgain" of cd 1 of stack "Answer Dialog" to 25
set the width of btn "DontAskAgain" of cd 1 of stack "Answer Dialog" to 120
set the bottomLeft of btn "DontAskAgain" of cd 1 of stack "Answer Dialog" to the bottomLeft of cd 1 of stack "Answer Dialog"
else
-- setup the templateButton
set the style of the templateButton to "checkbox"
set the label of the templateButton to "Don't Ask Again."
--
create btn "DontAskAgain" in cd 1 of stack "Answer Dialog"
--
reset the templateButton
--
set the style of btn "DontAskAgain" of cd 1 of stack "Answer Dialog" to "checkbox"
set the autoHilite of btn "DontAskAgain" of cd 1 of stack "Answer Dialog" to false
set the opaque of btn "DontAskAgain" of cd 1 of stack "Answer Dialog" to false
set the threeD of btn "DontAskAgain" of cd 1 of stack "Answer Dialog" to false
set the showBorder of btn "DontAskAgain" of cd 1 of stack "Answer Dialog" to false
set the hiliteBorder of btn "DontAskAgain" of cd 1 of stack "Answer Dialog" to false
set the height of btn "DontAskAgain" of cd 1 of stack "Answer Dialog" to 25
set the width of btn "DontAskAgain" of cd 1 of stack "Answer Dialog" to 120
set the bottomLeft of btn "DontAskAgain" of cd 1 of stack "Answer Dialog" to the bottomLeft of cd 1 of stack "Answer Dialog"
end if
end preOpenCard
before mouseUp pMouseButton
-- if the target is the check box, check the box and do not pass mouseUp
if the long ID of the target = the long id of btn "DontAskAgain" of cd 1 of stack "Answer Dialog" then
set the hilite of btn "DontAskAgain" of cd 1 of stack "Answer Dialog" to not (the hilite of btn "DontAskAgain" of cd 1 of stack "Answer Dialog")
exit to top
end if
end mouseUp
Example
dontaskagain "on" -- add the "Don't Ask Again" check box to the asnwer dialog
put "<p><b>Prompt</b></p>" into tPrompt
answer warning tPrompt with "Learn More" or "Continue" titled "Some Title"
put it into tAnswer
put dontaskstatus() into tDontAskAgain
dontaskagain "off"
Rountines
command dontAskAgain pActivate
switch pActivate
case "on"
set the behavior of cd 1 of stack "Answer Dialog" to the long id of btn "DontAskBehavior" of stack "libHrGUI"
break
case "off"
set the behavior of cd 1 of stack "Answer Dialog" to empty
delete btn "DontAskAgain" of cd 1 of stack "Answer Dialog"
break
end switch
end dontAskAgain
function dontAskStatus
if exists(btn "DontAskAgain" of cd 1 of stack "Answer Dialog") then
put the hilite of btn "DontAskAgain" of cd 1 of stack "Answer Dialog" into tDontAskAgain
return tDontAskAgain
else
return false
end if
end dontAskStatus
Script of btn "DontAskBehavior" of stack "libHrGUI"
-- This behavior script is used in conjunction with the handlers in the library (stack) script called:
-- command dontaskagain pActivate where pActivate is [on|off] i.e. dontaskahain "on" or dontaskagain "off"
-- function dontaskstatus i.e. put dontaskstatus() produces true|false
--
-- usage is in conjunction with the answer command. example:
-- dontaskagain "on"
-- answer warning "Some message I may not want to see again." with "Cancel" or "OK" titled "A Message"
-- put it into tAnswer
-- put dontaskstatus() into tDontAskAgain
-- dontaskagain "off"
-- put "Don't Ask is:"&&tDontAskAgain &&"And button clicked is:"&&tAnswer
after preOpenCard
if exists(btn "DontAskAgain" of cd 1 of stack "Answer Dialog") then
set the style of btn "DontAskAgain" of cd 1 of stack "Answer Dialog" to "checkbox"
set the autoHilite of btn "DontAskAgain" of cd 1 of stack "Answer Dialog" to false
set the opaque of btn "DontAskAgain" of cd 1 of stack "Answer Dialog" to false
set the threeD of btn "DontAskAgain" of cd 1 of stack "Answer Dialog" to false
set the showBorder of btn "DontAskAgain" of cd 1 of stack "Answer Dialog" to false
set the hiliteBorder of btn "DontAskAgain" of cd 1 of stack "Answer Dialog" to false
set the height of btn "DontAskAgain" of cd 1 of stack "Answer Dialog" to 25
set the width of btn "DontAskAgain" of cd 1 of stack "Answer Dialog" to 120
set the bottomLeft of btn "DontAskAgain" of cd 1 of stack "Answer Dialog" to the bottomLeft of cd 1 of stack "Answer Dialog"
else
-- setup the templateButton
set the style of the templateButton to "checkbox"
set the label of the templateButton to "Don't Ask Again."
--
create btn "DontAskAgain" in cd 1 of stack "Answer Dialog"
--
reset the templateButton
--
set the style of btn "DontAskAgain" of cd 1 of stack "Answer Dialog" to "checkbox"
set the autoHilite of btn "DontAskAgain" of cd 1 of stack "Answer Dialog" to false
set the opaque of btn "DontAskAgain" of cd 1 of stack "Answer Dialog" to false
set the threeD of btn "DontAskAgain" of cd 1 of stack "Answer Dialog" to false
set the showBorder of btn "DontAskAgain" of cd 1 of stack "Answer Dialog" to false
set the hiliteBorder of btn "DontAskAgain" of cd 1 of stack "Answer Dialog" to false
set the height of btn "DontAskAgain" of cd 1 of stack "Answer Dialog" to 25
set the width of btn "DontAskAgain" of cd 1 of stack "Answer Dialog" to 120
set the bottomLeft of btn "DontAskAgain" of cd 1 of stack "Answer Dialog" to the bottomLeft of cd 1 of stack "Answer Dialog"
end if
end preOpenCard
before mouseUp pMouseButton
-- if the target is the check box, check the box and do not pass mouseUp
if the long ID of the target = the long id of btn "DontAskAgain" of cd 1 of stack "Answer Dialog" then
set the hilite of btn "DontAskAgain" of cd 1 of stack "Answer Dialog" to not (the hilite of btn "DontAskAgain" of cd 1 of stack "Answer Dialog")
exit to top
end if
end mouseUp
Paul Dupuis
Researchware, Inc.
Researchware, Inc.