Dropper tool

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

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Dropper tool

Post by jmburnod » Tue May 12, 2009 6:47 pm

Hi All,

I'm very happy to discover a dropper tool in Revolution.
I try with a simple "choose dropper tool" :

The cursor change but it change after the clic to the browse tool and the pencolor dont change.

Something else is necessary ?

Thank

Jean-Marc

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Wed May 13, 2009 7:13 am

Dear Jean-Marc,

I'm a little surprised too, that the tools palette doesn't pick up the pencolor after this property is set by the dropper tool. Here's an example that might help you:

Code: Select all

on mouseUp
     choose dropper tool
     repeat until not (the tool is "dropper tool") with messages
          put the pencolor
          wait 20 millisecs with messages
     end repeat
end mouseUp
Best regards,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4174
Joined: Sun Jan 07, 2007 9:12 pm

Post by bn » Wed May 13, 2009 10:36 am

Jean-Marc,

I cant get the dropper tool to work in any meaningful way either. May be I miss something, for me it does pick up the color but does not revert the tool state, it stays in dropper mode.

Has anybody a working example for the dropper tool?

Marks example does not realy work for me either, it reverts when I click on the tools palette, but not when I click on anything else.

regards
Bernd

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Dropper tool

Post by jmburnod » Wed May 13, 2009 5:02 pm

Thanks Mark and Bernd,

The Mark'script work fine from a substack opended as palette (a tool palette)

A clic with the dropper tool change automaticaly the pencolor.
For the brushcolor it is necessary to "set the brushcolor to the pencolor"

Code: Select all

on mouseUp
  choose dropper tool
     repeat until not (the tool is "dropper tool") with messages
          set the brushcolor to  the pencolor
          set the backgroundcolor of grc "CurCol" to the pencolor
          wait 20 millisecs with messages
     end repeat 
end mouseUp
All the best

Jean-Marc

Post Reply