Color madness?

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10354
Joined: Wed May 06, 2009 2:28 pm

Color madness?

Post by dunbarx » Wed Nov 20, 2013 12:53 am

I have not tried this at home.

But in experimenting with a simple gadget to help a new user, I made two largish square buttons, and set the backColor of btn 2 to any old color. I put this into the card script:

Code: Select all

on mouseMove
   get the rect of btn 1
   put the mouseV into item 2 of it
   if the mouseloc is within the rect of btn 1 and the mouse is down then set the rect of btn 2 to it
end mouseMove
Not rocket science, button 2 "fills" or "empties" btn 1. But the when I move the cursor in a downward direction, the backcolor of btn 2 changes to dark purple. It displays the prescribed color just fine on the way up. If I clear the color of btn 2, same thing, basically, clear going up, purple going down.. If I start with two brand new rectangular buttons, not setting any color, there is no such effect. As soon as I set any backColor in btn 2, though, this odd effect appears.

I tried

Code: Select all

on mouseEnter
 set the backColor of btn 2 to "113,115,23" --arbitrary
end mouseEnter

on mouseMove
   get the rect of btn 1
   put the mouseV into item 2 of it
   if the mouseloc is within the rect of btn 1 and the mouse is down then
      put the backColor of btn 2 --to monitor while moving
      set the rect of btn 2 to it
   end if
end mouseMove
The initital setting ("113,115,23") is shown in msg going both up and down, and LC seems not to know about it. The purple "down" color seems to be overlaid on, not substituted for, the initial color. This can be seen if you try different starting colors. The purple "down" overlay mixes differently with any initial color choice.

Seems like a bug to me, and an odd one at that. LC 6.03, Mac OS 10.5.8

Craig Newman

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: Color madness?

Post by Simon » Wed Nov 20, 2013 3:35 am

I'm not seeing that here.
Win 7 liveCode 6.1.2

Nice solution to the question.

Wait... I do see a boarder disappearing along the bottom on the down motion not the up > When btn 2 is click on, not when btn 1 is clicked on.

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10354
Joined: Wed May 06, 2009 2:28 pm

Re: Color madness?

Post by dunbarx » Wed Nov 20, 2013 4:32 am

Simon.

Tried this at home. OSX 10.6.8, LC 6.1.3 Same weirdness.

Now if I do not reference that vary same button to another button, but rather to an arbitrary loc string:

Code: Select all

on mousemove
      if the mouse is down then set the rect of btn 2 to "200," & the mouseV & ",300,300" 
end mouseMove
There is no bogus color change. Something about the rect of another button??? Impossible.

Craig

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10354
Joined: Wed May 06, 2009 2:28 pm

Re: Color madness?

Post by dunbarx » Wed Nov 20, 2013 6:59 pm

Simon.

Found out that if the cursor touches btn 2, the purple thing appears. if it does not, normal colors. In my test, the mouseV and the top of btn 2 are coincident. If I have the cursor ride just above the top of btn 2, back to normal colors in both directions.

Craig

Post Reply