code for deselect polygon

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
kevin007
Posts: 40
Joined: Mon Sep 21, 2015 7:46 am

code for deselect polygon

Post by kevin007 » Mon Apr 18, 2016 11:31 am

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
--
Thanks
Kevin

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

Re: code for deselect polygon

Post by jmburnod » Mon Apr 18, 2016 11:33 am

Hi Kevin,
I think

Code: Select all

choose browse tool
From an other stack or substack like a tools palette.
Best regards
Jean-Marc
https://alternatic.ch

kevin007
Posts: 40
Joined: Mon Sep 21, 2015 7:46 am

Re: code for deselect polygon

Post by kevin007 » Mon Apr 18, 2016 11:39 am

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
--
Thanks
Kevin

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

Re: code for deselect polygon

Post by jmburnod » Mon Apr 18, 2016 12:00 pm

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
https://alternatic.ch

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

Re: code for deselect polygon

Post by dunbarx » Mon Apr 18, 2016 3:05 pm

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

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10052
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: code for deselect polygon

Post by FourthWorld » Mon Apr 18, 2016 4:22 pm

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).
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

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

Re: code for deselect polygon

Post by dunbarx » Mon Apr 18, 2016 5:11 pm

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

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

Re: code for deselect polygon

Post by jmburnod » Mon Apr 18, 2016 6:01 pm

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
https://alternatic.ch

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

Re: code for deselect polygon

Post by dunbarx » Mon Apr 18, 2016 6:14 pm

Jean-Marc

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

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

Re: code for deselect polygon

Post by jmburnod » Tue Apr 19, 2016 6:01 pm

Graig,
I tried with LC 6.7 and I get same result, mouseenter works only with browse tool.
Jean-Marc
https://alternatic.ch

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

Re: code for deselect polygon

Post by dunbarx » Tue Apr 19, 2016 7:02 pm

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

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

Re: code for deselect polygon

Post by jmburnod » Fri Apr 22, 2016 4:30 pm

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
https://alternatic.ch

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

Re: code for deselect polygon

Post by dunbarx » Fri Apr 22, 2016 5:03 pm

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

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

Re: code for deselect polygon

Post by jmburnod » Fri Apr 22, 2016 6:50 pm

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
https://alternatic.ch

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

Re: code for deselect polygon

Post by dunbarx » Fri Apr 22, 2016 7:36 pm

Jean-Marc.

Sure.

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

Craig

Post Reply