Getting default colors?

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Garrett
Posts: 386
Joined: Sat Apr 08, 2006 8:15 am
Contact:

Getting default colors?

Post by Garrett » Mon Sep 29, 2008 10:48 pm

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

Janschenkel
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 977
Joined: Sat Apr 08, 2006 7:47 am
Contact:

Post by Janschenkel » Tue Sep 30, 2008 6:35 am

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.
Quartam Reports & PDF Library for LiveCode
www.quartam.com

Garrett
Posts: 386
Joined: Sat Apr 08, 2006 8:15 am
Contact:

Post by Garrett » Tue Sep 30, 2008 7:10 am

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

Post Reply