using the bush tool without mousedown

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

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

using the bush tool without mousedown

Post by jmburnod » Wed Feb 10, 2010 3:49 pm

Hi All,

Is there a way to use the brush of the tools of drawing without maintaining the button of the mouse pushed ?

Jean-Marc
https://alternatic.ch

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4174
Joined: Sun Jan 07, 2007 9:12 pm

Re: using the bush tool without mousedown

Post by bn » Wed Feb 10, 2010 7:19 pm

Hi Jean-Marc,
that is a bit difficult but doable. The problem is that once you are in painting mode the image does not get the mouse messages like mouseUp etc. So to end painting I resorted to letting the user press the option-key (or alt-key on windows). Or when the user leaves the rect of the image browsing mode is restored. To begin painting the user has to click into the image.
I attach a stack that shows what I mean.
regards
Bernd
Attachments
paintwithoutmouseDown.rev.zip
(1.72 KiB) Downloaded 308 times

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

Re: using the bush tool without mousedown

Post by jmburnod » Thu Feb 11, 2010 7:29 pm

Hi Bernd,
Great. It work. Many thanks
It will allow children who cannot use the physical keyboard and the button of the mouse to draw with a joystick

Regards

Jean-Marc
https://alternatic.ch

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4174
Joined: Sun Jan 07, 2007 9:12 pm

Re: using the bush tool without mousedown

Post by bn » Thu Feb 11, 2010 8:40 pm

Hi Jean-Marc,
glad it works. If there is anything I could help you with this, just let me know.
regards
Bernd

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

Re: using the bush tool without mousedown

Post by jmburnod » Sat Feb 13, 2010 3:34 pm

Hi Bernd,

If you wait 3 seconds without moving you can go out the image with the browse tool
It work but if you click one more at the same place, the tool stay to browse (i need setting the tool to brush)

Regards

Jean-Marc

The new script of image 1 :

Code: Select all

local sLastLoc, sTrack,sdepTime --•• jmb 130210 add local sdepTime

on mouseUp
   put the ticks into sdepTime --•• jmb 130210 
   --breakpoint
   if sTrack is "" then put false into sTrack
   if sTrack is false then 
      put true into sTrack
      set the brushcolor to black
      set the brush to 8
      choose brush tool
      
      put the mouseLoc into sLastLoc
      send trackMouse to me in 25 milliseconds
   end if
end mouseUp

on mouseLeave
   put false into sTrack
   choose browse tool
end mouseLeave

on trackMouse
   if sTrack then
      -- once in paint mode the image does not get mouseUp/mouseDown messages
      -- that is why you have to end painting differently
      -- here I use the optionKey = Alt-key on windows
      if the optionkey is down then
         choose browse tool
         put false into sTrack
         exit trackMouse
      end if
      put the mouseLoc into tLoc
      
      --•• bernd
      --          drag from sLastLoc to tLoc
      --         put tLoc into sLastLoc
      --•• bernd end
      
      --•• JMB 130210
      if sLastLoc <>tLoc then
         drag from sLastLoc to tLoc
         put tLoc into sLastLoc
         put the ticks into sdepTime
      else
         if the ticks >sdepTime+180 then --•• after 3 seconds no move set the tool to browse
            choose browse tool
            exit to top
         end if
      end if
      --•••  JMB 130210 end
      
      if "trackMouse" is not in the pendingmessages then
         send trackMouse to me in 45 milliseconds -- change time as appropriate
      end if
   end if
end trackMouse

https://alternatic.ch

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4174
Joined: Sun Jan 07, 2007 9:12 pm

Re: using the bush tool without mousedown

Post by bn » Sat Feb 13, 2010 4:55 pm

Jean-Marc,
I just added one line of code, I post only the changed part. You had to set the script local variable sTrack to false. The way the mouseUp handler is now it only sets the sTrack to true, so when you want to get out of the tracking you have to set sTrack to false.

Code: Select all

   if the ticks >sdepTime+180 then --•• after 3 seconds no move set the tool to browse
            choose browse tool
             put false into sTrack -- Added this BN
            exit to top
         end if
I think that was the problem.
regards
Bernd

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

Re: using the bush tool without mousedown

Post by jmburnod » Sat Feb 13, 2010 6:52 pm

Yes Bernd,

That was the problem

Thanks

Jean-Marc
https://alternatic.ch

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

Re: using the bush tool without mousedown

Post by jmburnod » Thu Feb 18, 2010 7:27 pm

Hi Bernd,

The paintings tools (eraser,brush, bucket and spray) work fine but not in a standalone or with the player
What i forget ?
Any idea ?

Regards

Jean-Marc
https://alternatic.ch

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4174
Joined: Sun Jan 07, 2007 9:12 pm

Re: using the bush tool without mousedown

Post by bn » Thu Feb 18, 2010 7:48 pm

Hi Jean-Marc,
I just tried and it did not work with the standard settings. But if you go to the standalone settings ->General-> click "select inclusion for the standalone settings" then check -> brushes
That works for me in a standalone for MacOSX.
regards
Bernd

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

Re: using the bush tool without mousedown

Post by jmburnod » Thu Feb 18, 2010 8:50 pm

Hi Bernd,

Vielen Dank noch einmal.

Jean-Marc
https://alternatic.ch

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4174
Joined: Sun Jan 07, 2007 9:12 pm

Re: using the bush tool without mousedown

Post by bn » Thu Feb 18, 2010 8:53 pm

Jean-Marc,
pas de quoi, puisqu'on était practiquement des voisins...
salut
Bernd

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

Re: using the bush tool without mousedown

Post by jmburnod » Sat Feb 27, 2010 10:39 am

Guten Morgen Bernd,

I progress
I builded one revlet but no cursors for painting tools (i have in revmedia 4.0 and in standalone rev 4.0)
Do you have one more idea ?

Jean-Marc
https://alternatic.ch

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4174
Joined: Sun Jan 07, 2007 9:12 pm

Re: using the bush tool without mousedown

Post by bn » Sat Feb 27, 2010 11:54 am

Jean-Marc,
cursors in revlets do not work (yet). What I did in one case is I created a graphic which is shown at the location of the mouse pointer cursor
http://berndniggemann.on-rev.com/qtvr/
You could do something similar to indicate that the mode changed, not a native look but at least a feedback to the user.
If you want to go that road it should be relatively easy to show a e.g. dot near the cursor.
regards
Bernd

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

Re: using the bush tool without mousedown

Post by jmburnod » Sat Feb 27, 2010 12:30 pm

Thank Bernd
I'll do images cursor of painting tools

I saw the qtvr in revlet. It is nice

Jean-Marc
https://alternatic.ch

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

Re: using the bush tool without mousedown

Post by FourthWorld » Sat Feb 27, 2010 5:54 pm

bn wrote:Jean-Marc,
cursors in revlets do not work (yet). What I did in one case is I created a graphic which is shown at the location of the mouse pointer cursor
http://berndniggemann.on-rev.com/qtvr/
Why does that revlet require access to my hard drive?

Why does nearly every revlet deployed ask for that? Is there a bug in the standalone builder? Makes RevWeb seem like the scariest plugin ever invented.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Post Reply