Having some trouble with choose tool

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth, Except when i Jump

Having some trouble with choose tool

Post by sphere » Wed Oct 18, 2017 8:55 pm

Hi,

maybe i'm doing something wrong but:
When i have an image and do some drawing on it by "choose Brush tool" or "Choose pencil tool"
Then afterwards doing "choose Browse tool" or send "choose browse tool" to me in 1 tick does not work

i've tested choose Browse tool in
on mouseLeave (same with on mouseUp)
choose browse tool
end mouseLeave

on mouseEnter (same with on mouseDown)
choose brush tool
end mouseEnter

but most of the time it does not return to the Browse tool, it looks like it hangs in an undefined state
Then i have to actually click the Browse tool in the Tools Pane to get it in that state

in LC8.1.6 in LC8.1.7rc3 in LC9.0DP9

In short: switching between browse tool or a paint tool and back is not working ok

am i doing something wrong or is it simply not possible?

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2718
Joined: Sat Dec 22, 2007 5:35 pm
Location: Genève
Contact:

Re: Having some trouble with choose tool

Post by jmburnod » Wed Oct 18, 2017 10:16 pm

Hi,
Mouseenter and mouseleave are only sent with browse tool.
Put your btns tool in a an other stack or substack, set the name of this stack to "mypaintTools" (or what you want) and type in messagebox

Code: Select all

palette stack myPaintTools
and it should work 8) but this stack is not editable
Use the topLevel command to display the stack in an editable window.

Code: Select all

toplevel stack myPaintTools
Best regards
Jean-Marc
https://alternatic.ch

sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth, Except when i Jump

Re: Having some trouble with choose tool

Post by sphere » Thu Oct 19, 2017 5:22 pm

Thanks Jim i will try some.

I'm trying to get it in a single stack only, so not floating over substacks.

**edit**
thanks for pointing me to palette, maybe it's useful, not sure yet.

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2718
Joined: Sat Dec 22, 2007 5:35 pm
Location: Genève
Contact:

Re: Having some trouble with choose tool

Post by jmburnod » Thu Oct 19, 2017 7:43 pm

I tried to do it in one stack
It is possible to use mousemove
Not sure that is a good way. I think that an other stack is better
Here is a stack using mousemove to do what you describe
Best regards
Jean-Marc
SetToolOneStack.zip
(1.98 KiB) Downloaded 152 times
https://alternatic.ch

sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth, Except when i Jump

Re: Having some trouble with choose tool

Post by sphere » Thu Oct 19, 2017 8:38 pm

Merci Beaucoup Jean-Marc!

i will check it out. :D

***edit***:
I like it very much!
How i did it, on mouseLeave did not work stable.
But your group aproach works flawless, also seeing the way how you programmed it gives me some more insights on how to handle such a thing.
Still learning a lot in these years.

Thanks a lot!

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2718
Joined: Sat Dec 22, 2007 5:35 pm
Location: Genève
Contact:

Re: Having some trouble with choose tool

Post by jmburnod » Fri Oct 20, 2017 4:44 pm

Hi
I persist to think that palette stack for tools is better, but you maybe have good reasons to do this in one stack without substack. If that is the case I'm interesting to know more about it.
1. It avoid using mousemove to set the current tool
2. It will be easier to move a palette tools than a group tools
3. Once you have made your tools palette you can using it for others apps
4. ...
Best regards
Jean-Marc
https://alternatic.ch

sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth, Except when i Jump

Re: Having some trouble with choose tool

Post by sphere » Fri Oct 20, 2017 7:16 pm

Hi Jim

the idea is to have an image(svg), which in fact can be anything which you want to use as a background.
Then on that image i want to move (grab) other small images, this is working.
I also want to annotate on that image or around the smaller images, that also works.
But i also want to move the image again and be able to delete the annotations(small drawings).

And i want to use this program on a multitouch screen...i have a few ideas that may help me as a startup so i can make some extra income and get started with a indy or bussiness LC version.
And since Livecode does not support multi touch support for windows (while this is natively present since windows7) i'm stuck with only single touch thus simple mouse.
So no zooming possible with 2 fingers, no scrolling with fingers, no other gestures possible.

So i have to be able to get it done with mouse commands for windows...but we have also with Android built in and now we have multitouch available. But did not test it yet. Unfortunately for any system/OS you have ideas but one works on a OS but not on the othre and vice versa.
Not that i own these screens, i repair them. So i have direct access to these big 4K touch screens (resolution 3840x2160) and can test some things on how it reacts. That's why i want one single stack and never have have a possibility that a floating stack gets behind the main stack. (maybe that's preventable)
It's really time to get multi touch support for Windows

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2718
Joined: Sat Dec 22, 2007 5:35 pm
Location: Genève
Contact:

Re: Having some trouble with choose tool

Post by jmburnod » Sat Oct 21, 2017 9:57 am

Hi,
So no zooming possible with 2 fingers
Yes, you're right but you can work around using a resize box.
You maybe may (no tested) use a mousedown with one param pMouseButtonNumber ( 1,2 or 3)

Code: Select all

on mouseDown pMouseButtonNumber -- show popup menu on Control/Right-click
   put "doMyZoomIn,doMyZoomOut" into tAllMessages
   put item pMouseButtonNumber of tAllMessages into tOneMessage
   repeat until the mouse is up
       send tOneMessage to me in 1 milliseconds
   end repeat
end mouseDown

on doMyZoomIn
   --    do your resize message
end doMyZoomIn

on doMyZoomOut
   --    do your resize message
end doMyZoomOut
no scrolling with fingers
You may use rawkeydown for that

Code: Select all

local sCurScrollGr
on mouseenter
   put "scrollgroup1" into sCurScrollGr
   degrCadreME sCurScrollGr
end mouseenter

on rawkeydown pRawKey
   put "65309,65308" into tLesK
   if pRawKey is in tLesK then
      put 24 into tEmpan
      if sCurScroll <> empty then
         if the mouseloc is within the rect of group sCurScrollGr then
            if pRawKey = 65308 then
               put tEmpan into tSec
            end if
            if pRawKey = 65309 then
               put (0-tEmpan) into tSec
            end if
            set the vscroll of group sCurScrollGr to (the vscroll of group sCurScrollGr)+tSec
         end if
      end if
   else
      pass rawkeydown
   end if
end rawkeydown
floating stack gets behind the main stack. (maybe that's preventable)
That doesn't happen with a palette stack
https://alternatic.ch

sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth, Except when i Jump

Re: Having some trouble with choose tool

Post by sphere » Sat Oct 21, 2017 7:06 pm

Thanks Jim.

for the first one, maybe mouseStillDown is better because in most case there is no keyboard available to hold the ctrl key and then click/touch, just a touch screen. (other programs do that too, holding your finger on the screen for a while pops up a menu, just like right mouseclick on the desktop.)
Also the pinch lesson is perfect for this, works great on android, so i can test this with one of the screens(which also has android) and see if it behaves the same as on my phone, and this hoepfully would work the same for windows in combination with the code you've written.

For the second where can i find those rawkeynr's ?
i've searched but maybe in the wrong place.

I tried to capture them, hoping that a touch would present a keynr: http://forums.livecode.com/viewtopic.ph ... 88#p159207 but there was nothing given (perhaps i did it not in the good way)

I will do some testing the comming week with your suggestions.
Thanks a lot, and i'll let you know how it reacts.

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”