Stack "Answer Dialog"

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
jmk_phd
Posts: 213
Joined: Sat Apr 15, 2017 8:29 pm

Stack "Answer Dialog"

Post by jmk_phd » Sun May 22, 2022 10:09 am

Before publishing an app that I've been working on since 2014, I've found a snippet of code that I'd included at some point over the years, employed whenever displaying an LC answer dialog while the entire screen background is set to black:

Code: Select all

set the backgroundColor of card 1 of stack "Answer Dialog" to "white"
   answer information "Ready to begin Subtest" && sSubtestCounter with "Cancel" or "Begin"
   toplevel the owner of me
   set the defaultstack to the owner of me
Apparently at some time in the past I'd inserted this in order to force the answer dialog to display over the black background, but my app does not include any such substack. Presumably, this snippet employed something internal to LC that I must've run across somewhere online.

Does this ring a bell with anyone? Running LC 9.6.7, an answer dialog seems to display over a black background even without this code.

Thanks.

jeff k

Klaus
Posts: 13806
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Stack "Answer Dialog"

Post by Klaus » Sun May 22, 2022 10:25 am

Hi Jeff,
jmk_phd wrote:
Sun May 22, 2022 10:09 am
...
Apparently at some time in the past I'd inserted this in order to force the answer dialog to display over the black background, but my app does not include any such substack. Presumably, this snippet employed something internal to LC that I must've run across somewhere online.
...
when LC creates a desktop runtime it will make these two (separate in the IDE) stacks Ask/Answer dialog SUBSTACKS of the stack you create the runtime from and then "wrap" the egine around it. This way they will inherit all the properties like bg color from that stack.
jmk_phd wrote:
Sun May 22, 2022 10:09 am
...
Running LC 9.6.7, an answer dialog seems to display over a black background even without this code.
...
Not sure I understand this one?! Do you mean the code snippet is not neccessary anymore and the dialogs will behave as exspected or not?


Best

Klaus

jmk_phd
Posts: 213
Joined: Sat Apr 15, 2017 8:29 pm

Re: Stack "Answer Dialog"

Post by jmk_phd » Sun May 22, 2022 10:45 am

Hi Klaus --
Do you mean the code snippet is not neccessary anymore and the dialogs will behave as expected or not?
Yes, I believe so. Although I've left untouched the code snippet that displays the answer dialog at the start of each subtest, this snippet is *not* included when displaying an answer dialog -- while the background is still black -- that the test has been completed.

This leads me to believe that the code snippet may be an archaic requirement of older versions of LC. (What's still uncertain is whether I need to include that snippet somewhere at least once.)

jeff k

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7215
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Stack "Answer Dialog"

Post by jacque » Sun May 22, 2022 5:58 pm

I suspect the issue has been fixed by now. Substacks inherit the background color of the mainstack, but there may be an exception for LC dialogs now. I haven't seen them being anything but white for as long as I can remember. It would be easy to test, just comment out the script snippet and build the app.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

jmk_phd
Posts: 213
Joined: Sat Apr 15, 2017 8:29 pm

Re: Stack "Answer Dialog"

Post by jmk_phd » Mon May 23, 2022 2:27 am

Thanks much for the feedback. Following the principle, "If it ain't broke, don't fix it," I've left this odd snippet in place wherever it occurred (and, for consistency, added it to the one remaining instance of an answer dialog that displays while backdrop is set to black). I figure that the overhead incurred by a few extra lines is trivial.

One puzzle: When building a standalone I've always selected the inclusions manually, and (despite recent name changes) identified the two -- for encryption and printing to pdf -- that are needed. However, I've found also that *not* selecting the (also renamed) Answer and Ask Dialog items in the inclusions list does not prevent these dialogs from displaying properly when running the standalone (at least in macOS; not tried yet in Windows).

I assume that best practice is to include these as well -- as I'd done in past years -- but I'm wondering why.

(I encountered some bizarre error messages referencing Ask and Answer when building a standalone -- often crashing the IDE -- when these were included, but I can't pinpoint the cause for certain.)

jeff k

Klaus
Posts: 13806
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Stack "Answer Dialog"

Post by Klaus » Mon May 23, 2022 8:54 am

Hi Jeff,
jmk_phd wrote:
Mon May 23, 2022 2:27 am
...
One puzzle: When building a standalone I've always selected the inclusions manually, and (despite recent name changes) identified the two -- for encryption and printing to pdf -- that are needed. However, I've found also that *not* selecting the (also renamed) Answer and Ask Dialog items in the inclusions list does not prevent these dialogs from displaying properly when running the standalone (at least in macOS; not tried yet in Windows).
these are checked by default in the list of inclusions, maybe you just overlooked this?
jmk_phd wrote:
Mon May 23, 2022 2:27 am
...
(I encountered some bizarre error messages referencing Ask and Answer when building a standalone -- often crashing the IDE -- when these were included, but I can't pinpoint the cause for certain.)
Just a thought:
Does this happen if you create a standalone from the same stack more than once in a LC session?
Obviously LC does not delete the temporary stack that it uses for the runtime after successful creating the standalone.
So next time you create the runtime again you get the "A stack with that name is already in memory..." loop of death or something else. I already bug reported this.


Best

Klaus

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7215
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Stack "Answer Dialog"

Post by jacque » Mon May 23, 2022 5:56 pm

Not only are the ask/answer dialogs included by default, but if you deselect them they come back anyway. LC insists you include them. I suspect they didn't want false bug reports that ask and answer were broken.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

jmk_phd
Posts: 213
Joined: Sat Apr 15, 2017 8:29 pm

Re: Stack "Answer Dialog"

Post by jmk_phd » Mon May 23, 2022 10:23 pm

My thanks to Klaus and Jacque for the information:

When Klaus wrote:
LC does not delete the temporary stack that it uses for the runtime after successful creating the standalone.
So next time you create the runtime again you get the "A stack with that name is already in memory..." loop of death or something else.
That describes exactly what I'd experienced, and almost certainly why. Easy enough to avoid.

And Jacque resolved the mystery regarding inclusions when she wrote:
Not only are the ask/answer dialogs included by default, but if you deselect them they come back anyway.
I guess that makes selecting inclusions manually a bit more idiot-proof.

jeff k

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”