Page 1 of 1

code for deselect polygon

Posted: Mon Apr 18, 2016 11:31 am
by kevin007
Hi all,

When I use the following code automatically polygon tool is selected, is it any way to deselect it? Is it possible

Code: Select all

On mouseUP
choose polygon tool
End mouseUP
Thanks
Kevin

Re: code for deselect polygon

Posted: Mon Apr 18, 2016 11:33 am
by jmburnod
Hi Kevin,
I think

Code: Select all

choose browse tool
From an other stack or substack like a tools palette.
Best regards
Jean-Marc

Re: code for deselect polygon

Posted: Mon Apr 18, 2016 11:39 am
by kevin007
Hi

I am use your code but it's not working. How i solve this problem ?

Code: Select all

on mousedown tButton
   if tButton = 1 then
      choose rectangle tool
      end if
  if tButton = 3 then
    choose browse tool
  end if
end mousedown
Thanks
Kevin

Re: code for deselect polygon

Posted: Mon Apr 18, 2016 12:00 pm
by jmburnod
It seems mouse events are not sent when the current tool is not "browse".
You can go back to browse tool from an other stack or substack.
Create a substack "stMyTools"
Create a btn "Polygon" with this script

Code: Select all

on mouseUp
   choose polygon tool
end mouseUp
Create a btn "Browse" with this script

Code: Select all

on mouseUp
   choose browser tool
end mouseUp
Type on the message box

Code: Select all

palette stack stMyTools
Stack stMyTools is like a palette and you can choose your current tool

Re: code for deselect polygon

Posted: Mon Apr 18, 2016 3:05 pm
by dunbarx
There are several messages that are sent in edit mode, mostly mouse related (mouseMove, mouseEnter, mouseLeave, mouseDoubleDown).

Whether these can be of use to you is another story.

Craig Newman

Re: code for deselect polygon

Posted: Mon Apr 18, 2016 4:22 pm
by FourthWorld
jmburnod wrote:It seems mouse events are not sent when the current tool is not "browse".
They are sent by the engine, but the IDE traps them for editing use. You'll find them reliably sent in a standalone, and while developing you can let the IDE pass them by suspending the IDE when testing those script (Development->Suspend Development Tools).

Re: code for deselect polygon

Posted: Mon Apr 18, 2016 5:11 pm
by dunbarx
What Richard said.

But for your issue, would double clicking on the card do, if you had in the card script"

Code: Select all

on mouseDoubleDown
   choose browse tool
end mouseDoubleDown
Otherwise your choices in the IDE are limited, unless you use, say, a "mouseEnter" handler in a button that is named "Browse".

Craig

Re: code for deselect polygon

Posted: Mon Apr 18, 2016 6:01 pm
by jmburnod
I tried mouseenter with one btn "browse" and one btn "polygon"
development tools suspended.
Only mouseenter with browse tool works for me (LC 7.06)
MouseDoubleDown in cd script works but creates a polygon before (if polygon is the currrent tool of course) :D
Jean-Marc

Re: code for deselect polygon

Posted: Mon Apr 18, 2016 6:14 pm
by dunbarx
Jean-Marc

I had ordinary development tools (not suspended) in v. 6.7.

Re: code for deselect polygon

Posted: Tue Apr 19, 2016 6:01 pm
by jmburnod
Graig,
I tried with LC 6.7 and I get same result, mouseenter works only with browse tool.
Jean-Marc

Re: code for deselect polygon

Posted: Tue Apr 19, 2016 7:02 pm
by dunbarx
Jean-Marc.

On a new card with a button. Put this in the card script:

Code: Select all

on mouseEnter
   put the target
end mouseEnter

on mouseLeave
   put the name of this cd
end mouseLeave

on mouseDoubleDown
   choose browse tool
end mouseDoubleDown
With the edit tool chosen, move the cursor in and out of the button rect. When you double-click on the card, the browse tool is selected. OS10.9.5, LC 6.7.9.

Craig

Re: code for deselect polygon

Posted: Fri Apr 22, 2016 4:30 pm
by jmburnod
Craig,

Sorry if I don't understand but when I choose graphic oval tool.
Card script:

Code: Select all

on mouseEnter
      put the target
      put the ticks && "mouseEnter"
end mouseEnter
The target = empty (with development tools or not)
Jean-Marc

Re: code for deselect polygon

Posted: Fri Apr 22, 2016 5:03 pm
by dunbarx
Jean-Marc.

This will only work with a graphic tool if the graphic is selected, which means the last one created. I cannot select an existing grc and then choose the graphic tool. That deselects it.

Create a new grc. Immediately move the cursor in and out of the selected control. The messages are sent.

The edit tools works with any control.

Craig

Re: code for deselect polygon

Posted: Fri Apr 22, 2016 6:50 pm
by jmburnod
Craig,
Create a new grc. Immediately move the cursor in and out of the selected control. The messages are sent.
Yes, but the first question was "choose polygon tool" not "create a polygon".
Jean-Marc

Re: code for deselect polygon

Posted: Fri Apr 22, 2016 7:36 pm
by dunbarx
Jean-Marc.

Sure.

My thread went off topic, more general LC talk...

Craig