Page 1 of 1

Getting default colors?

Posted: Mon Sep 29, 2008 10:48 pm
by Garrett
Well, seems I'm on a roll with questions lately :-(

I can't figure out how to find out what the default colors are for things like foregroundColor and such.

Thanks in advance,
~Garrett

Posted: Tue Sep 30, 2008 6:35 am
by Janschenkel
Hi Garrett,

You can tack the 'effective' keyword onto a number of properties to figure out what their value is if it hasn't been set directly on the control and thus 'inherited' from higher up in the hierarchy (group, card, stack, mainstack).

So you could do something like this:

Code: Select all

on mouseUp
   create field
   answer the effective foregroundcolor of the last field
   delete the last field
end mouseUp
And this should give you the 'default' foregroundcolor of a field, provided no foregroundcolor was set on the card or the stack or the mainstack of the stack in case it's a substack.

To get at the engine-level default colors you could always do something like this:

Code: Select all

on mouseUp
   set the destroyStack of the templateStack to true
   create invisible stack
   put it into tStackRef
   set the defaultStack to tStackRef
   create field
   answer the effective foregroundcolor of the last field
   delete tStackRef
end mouseUp
Hope this helped,

Jan Schenkel.

Posted: Tue Sep 30, 2008 7:10 am
by Garrett
Ah sweet! I knew it could be done, but just couldn't find the right keyword to do it!

I tried "default", but of course that won't work.. LOL

Code: Select all

answer the default foregroundColor of me
Hey! it sounded like the right thing to do!! ;-)

Thanks a bunch for the answer, very very much appreciated,
~Garrett