Page 1 of 1

Do answer dialogs inherit the stack's backgroundColor?

Posted: Fri Jul 13, 2012 2:06 am
by ctflatt
I just ran into this and am wondering if this is the correct behavior:

I am setting the backgroundColor of a stack to 0,0,0 in a preOpenStack handler.

Each card inherits this backgroundColor property as expected, but call answer dialog from a button on a card in said stack and the background color of the answer dialog also appears to be 0,0,0 when saved as a standalone for Mac OS X (Universal).

I have uploaded the stack and standalone here, if someone could verify (2.9 Mb):

http://www.christopherflatt.com/forumFi ... erTest.zip

Is this correct behavior?

Thanks!

Todd

Re: Do answer dialogs inherit the stack's backgroundColor?

Posted: Fri Jul 13, 2012 10:34 am
by bn
Hi Todd,

I can confirm that the answer dialog in the standalone is black.
I guess this is because by setting the backgroundColor of your mainstack all substacks inherit the black backgroundColor. In the IDE the stack "Answer Dialog" is part of the IDE and not a substack of your stack. Hence it does not inherit the black background.
In the standalone it seems that the stack "Answer Dialog" is a substack of your main stack.
You could either set the backgroundColors of the cards of your mainstack to black in the preopenstack handler or in the properties inspector.
Or you could do this:

Code: Select all

on preOpenStack
   set the backgroundColor of this stack to black 
   if the environment is "standalone application" then set the backgroundColor of stack "Answer Dialog" to 231,231,231
   set the loc of this stack to the screenLoc
end preOpenStack
In the standalone the answer dialog appears as usual. 231,231,231 seems to be the normal backgroundColor of the answer dialog on MacOSX.

I would probably go for setting the backgroundColor of the cards. Is there any specific reason you set the backgroundColor dynamically on preopencard? Why don't you set it in the properties inspector?

Kind regards

Bernd

Re: Do answer dialogs inherit the stack's backgroundColor?

Posted: Fri Jul 13, 2012 11:28 am
by ctflatt
Bernd:

Thanks for checking this.

I came across this early this morning, which resolved my issue:

Code: Select all

set the backgroundColor of card 1 of stack "Answer Dialog" to (color)
As to why I set it in the script, I have been working really hard this year on my scripting, and am doing everything I can programmatically. Is there a downside to this of which you are aware? I could set the property in the inspector, but I guess it's a new habit I have formed to set it in this manner.

I really appreciate you taking the time to look into this.

Be well.

:Todd

Re: Do answer dialogs inherit the stack's backgroundColor?

Posted: Fri Jul 13, 2012 12:51 pm
by Klaus
Hi Todd,
ctflatt wrote: Is there a downside to this of which you are aware?
Except the return of the 10 plagues?
No :D

Yes, the "Ask/Answer" dialogs, which are "simple" LiveCode stacks, inherit the properties
of your standalone stack. In the IDE these dialogs are separate stacks with some properties
NOT set (like bg color!) and they inherit these from a LiveCode IDE stack (HOME or TOOLS).

The standalone builder will make a copy of these stacks and makes them substacks of
your standalone stack, so they will inherit the bg color BLACK, unless you set the bg color
separately like you do now.

Best

Klaus