Selecting tools

Moderators: LCNeil, heatherlaine, kevinmiller, elanorb

Post Reply
marcelloe
Posts: 140
Joined: Thu Oct 17, 2013 2:26 pm

Selecting tools

Post by marcelloe » Fri Oct 25, 2013 7:04 pm

Now I am trying to use different tools to create a picture and want to select between the different tools. This is the code I think I need to use. Am I even heading in the right direction.

On the tool buttons

on mouseUp
put "spray can" into currentToolUse
end mouseUP

in the drawing area
global currentToolUse

on mouseEnter
global currentToolUse
choose currentToolUse tool
end mouseEnter

on mouseLeave
choose browser tool
end mouseLeave

LCNeil
Livecode Staff Member
Livecode Staff Member
Posts: 1223
Joined: Wed Oct 03, 2012 4:07 pm

Re: Selecting tools

Post by LCNeil » Tue Oct 29, 2013 7:22 pm

Hi Mark,

I see that you have posted in the general forums and had a few responses but I will attempt to help here as well.

Yes, you are on the right path. You can use a global variable to select a tool and then have this activated when the mouse enters the draw area.

You almost had the script correct for your tool button. You will want to ensure that you have your global variable defined and the correct syntax for the tool. The below is an example of how to select a tool with one button and then set the current tool to it

(button1)
global currentToolUse
on mouseUp
put "spray can" into currentToolUse
end mouseUp

(button2)

global currentToolUse
on mouseUp
choose quote & currentToolUse & quote && "tool"
end mouseUp

This should hopefully give you some leads with implementing this functionality in your stack.

Kind Regards,

Neil Roger
--
RunRev Support Team ~ http://www.runrev.com
LiveCode – Realize fast, compile-free coding
--

marcelloe
Posts: 140
Joined: Thu Oct 17, 2013 2:26 pm

Re: Selecting tools

Post by marcelloe » Tue Oct 29, 2013 8:15 pm

I think I am missing something simple here. If I select the spray can button in run mode and try to draw all I get is a blank screen. If I look in the project browser I see an item title image.

I am assuming this part of the script will go into the drawing area.

LCNeil
Livecode Staff Member
Livecode Staff Member
Posts: 1223
Joined: Wed Oct 03, 2012 4:07 pm

Re: Selecting tools

Post by LCNeil » Wed Oct 30, 2013 2:14 pm

Hi Mark,

You may be seeing a blank screen as your brushColor might be set to white. This would give the impression that nothing is being drawn on screen.

Please find attached a sample stack that should be able to assist with selecting tools, changing colors, clearing a draw area and setting the tool to browse when a mouseLeave is triggered from an image area

Kind Regards,

Neil Roger
--
RunRev Support Team ~ http://www.runrev.com
LiveCode – Realize fast, compile-free coding
--
Attachments
color.livecode.zip
(1.39 KiB) Downloaded 197 times

Post Reply

Return to “idea2app and Coding School”