Bacground color of tabbed button

Sarah Reichelt sarah.reichelt at gmail.com
Sat Feb 17 01:09:51 EST 2007


> > The background color for the stack can be changed by the user, which
> > chnges the background color of the tabbed button, but by varying
> > amounts, so I can't hard-wire either a color or a color difference. I
> > just need a way to find the real color of a certain area of the
> > window.
>
> It's so ugly it hurts, but:
>
>    put the screenmouseloc into tLoc
>    set the screenmouseloc to x,y -- the location you need to read
>    put the mousecolor into tColor -- this is the color
>    set the screenmouseloc to tLoc
>
> It happens so fast I don't even need to lock the screen, but you might
> want to test on slower machines to make sure.
>
> I vaguely remember someone else had another way to do it but I can't
> recall what it was. Scott Raney suggested the above when I asked about
> the same thing some years ago.

Sigh!

Thanks Jacque, after I emailed the question I worked this one out but
it was so awful that I hoped there was a better way...

Ah well, at least it works.

For anyone wanting to know the full details, here is the full script I use:

    put the topleft of btn "Tabs" into tL
    put the screenmouseloc into tOldMouse
    add 10 to item 1 of tL
    add 15 to item 2 of tL  -- move right & down to avoid the corner
    set the screenmouseloc to globalloc(tL)
    put the mousecolor into tCol
    set the screenmouseloc to tOldMouse
    set the backcolor of fld "Status" to tCol

After setting the backColor or the stack, you can't do this instantly
as it takes some time for the tabbed backgroound to be updated. I call
this 5 ticks after setting the backcolor and that seems fine. 1 tick
worked most of the time on my 2 GHz iMac, so hopefully 5 will be safe.
I might push it out to 10 as the field I need to set will not be
visible when this change is happening.

Thanks,
Sarah



More information about the use-livecode mailing list