Rectangle Problem

Ken Ray kray at sonsothunder.com
Tue Apr 5 22:06:27 EDT 2005


On 4/5/05 4:05 PM, "David Burgun" <dburgun at dsl.pipex.com> wrote:

>>>  Is there any easy way to get this functionality into my stack?
>> 
>> Dave, is there any reason you're not using the built in functionality of Rev
> 
> On big reason, I don't know how to do it?
> 
>> - i.e. to set the tool to the rectangle tool and then after they finish
>> drawing to switch to the pointer tool?
> 
> Not sure what you mean? Exactly what code do I use and which handler
> do I use? Oh and which object should I attach the script to?

Well, suppose you've got a stack that is supposed to be your drawing area,
and you have a palette of tools (like a rectangle for drawing rectangles,
and an arrow for going into "pointer" tool mode - you may have more, but you
get the idea).

In the floating palette you set the tool of the topStack when a tool is
clicked:

  on mouseUp  -- the "rectangle tool" button
    choose graphic tool
  end mouseUp

  on mouseUp  -- the "pointer tool" button
    choose pointer tool
  end mouseUp

When a new graphic is created, you'll get a 'newGraphic' message, and you
can do something like this to make sure it is "selected" (i.e. it has
resizing handles):

  on newGraphic  
    set the selected of the target to true
  end newGraphic

HTH,

Ken Ray
Sons of Thunder Software
Web site: http://www.sonsothunder.com/
Email: kray at sonsothunder.com




More information about the use-livecode mailing list