Re: handler to connect buttons with a line

2011-11-01 Thread André Bisseret
Bonjour Richmond,

Vraiment très joli !

André


Le 31 oct. 2011 à 20:20, Richmond a écrit :

 if you adjust this:
 
 on mouseDown
  grab me
 end mouseDown
 
 to this:
 
 on mouseDown
  grab me
 set the idleRate to 1
 end mouseDown
 
 you get fairly spiffy results!
 


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: handler to connect buttons with a line

2011-11-01 Thread James Hurley
Kresten,

I think I understand. The card script below will create n button and n * (n-1) 
connecting  lines.

As the buttons are moved the connecting lines follow.

Jim Hurley

local myNAME, n

on mouseDown
   put the  short name of the target into myName
   put 5 into n
   repeat with i = 1 to n
  put radio i into tName
  if there is no button tName then
 create button tName
 set the style of button tName to radioButton
 set the width of button tName to 20
 set the loc of button tName to 20 + i*40,20
 set the borderWidth of button tName to 0
  end if 
   end repeat
   
   repeat with i = 1 to n
  repeat with j = i+1 to n
 put line  i  j into tName
 if there is no grc tName then
create grc tName
set the style of grc tName to line
set the layer of grc tName to bottom
 end if
  end repeat
   end repeat
end mouseDown

on mouseMove x,y
   if myName is  then exit mouseMove
   if not (myName  contains radio)  then exit mouseMove
   set the loc of button myName to x,y
   repeat with i = 1 to n
  put radio  i into tStart
  repeat with j = i+1 to n
 put radio  j into tEnd
 put line  i  j into tName
 set the points of grc tName to the loc of button tStart  cr  the loc 
of button tEnd
  end repeat
   end repeat
end mouseMove

On mouseUp
   put   into myName
end mouseUp

on MouseLeave
   put  into myName
end MouseLeave


 --
 
 Message: 6
 Date: Mon, 31 Oct 2011 15:38:03 +0100
 From: Kresten Bjerg kresten.bj...@psy.ku.dk
 To: use-livecode@lists.runrev.com use-livecode@lists.runrev.com
 Subject: handler to connect buttons with a line
 Message-ID:
   8962f0e4bd055148aa4051d91f7eb4a908f13c6...@ibtmail2a.ibt.ku.dk.ad
 Content-Type: text/plain; charset=us-ascii
 
 Hello
 I have been experimenting to create a handler (as button or menu), which will 
 permit user
 
 a)  To select two existing moveable button
 
 b)  Create a line, attaching its endpoints to the buttons, so line will 
 stay between them wherever they are positioned on the card.
 
 c)   It is important that same button can be connected to more buttons, 
 thus creating a simple user-built and editable mindmap.
 My experiments - I am lousy as a programmer - have  been of no avail.
 Could somebody help, and sketch a handler ?
 The context is that of extending the functionalities of a freeware 
 patient/citizen diary  www.phenomenalog.dkhttp://www.phenomenalog.dk
 Best regards
 Kresten Bjerg  kresten.bj...@psy.ku.dkmailto:kresten.bj...@psy.ku.dk
 


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: handler to connect buttons with a line

2011-11-01 Thread James Hurley
Correction: That should have been n * (n-1)/2 connecting lines. Same as the 
number of hand shakes among n people.  :-)

Jim


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: handler to connect buttons with a line

2011-10-31 Thread Jim Lambert
Kresten,

  Create a line, attaching its endpoints to the buttons, so line will stay 
 between them wherever they are positioned on the card.


I believe there are such handlers in the AnimationEngine library.

Jim Lambert


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: handler to connect buttons with a line

2011-10-31 Thread Malte Brill
Hi Kersten,

on card level:

on moveControl
   set the points of grc 1 to the loc of btn 1crthe loc of btn 2
end moveControl

This is not moving the line while dragging though. Stuff to handle that indedd 
is in AE (Thanks for the plug Jim!)

Cheers,

Malte

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: handler to connect buttons with a line

2011-10-31 Thread Richmond

On 10/31/2011 07:25 PM, Jim Lambert wrote:

Kresten,


  Create a line, attaching its endpoints to the buttons, so line will stay 
between them wherever they are positioned on the card.

Well, it doesn't feature live updating, by I did thi2:

created a card, with a graphic object Line, and 2 buttons, Button 
and Button1 respectively [I made
them 24 x 24 squares, set their labels to an empty space and coloured 
them red].


made a field called VL'

put this script in Button:

on mouseDown
  grab me
end mouseDown

on mouseUp
  put the mouseLoc into VL1
  set the loc of me to VL1
  put the loc of btn Button into line 1 of fld VL
  put the loc of btn Button1 into line 2 of fld VL
  set the points of graphic line to fld VL
end mouseUp

and, surprise, surprise, this script in Button1:

on mouseDown
  grab me
end mouseDown

on mouseUp
  put the mouseLoc into VL2
  set the loc of me to VL2
  put the loc of btn Button into line 1 of fld VL
  put the loc of btn Button1 into line 2 of fld VL
  set the points of graphic line to fld VL
end mouseUp


if you are really excited about this (har, har) I can send you the stack 
off-list.

Although it would be dead easy to do it yourself.

Richmond.

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: handler to connect buttons with a line

2011-10-31 Thread Richmond

Cop a load of this:

put this script in Button:

on mouseDown
  grab me
end mouseDown

on mouseStillDown
  put the mouseLoc into VL1
  set the loc of me to VL1
  put the loc of btn Button into line 1 of fld VL
  put the loc of btn Button1 into line 2 of fld VL
  set the points of graphic line to fld VL
end mouseStillDown

on mouseUp
  put the mouseLoc into VL1
  set the loc of me to VL1
  put the loc of btn Button into line 1 of fld VL
  put the loc of btn Button1 into line 2 of fld VL
  set the points of graphic line to fld VL
end mouseUp

and, surprise, surprise, this script in Button1:

on mouseDown
  grab me
end mouseDown

on mouseStillDown
  put the mouseLoc into VL2
  set the loc of me to VL2
  put the loc of btn Button into line 1 of fld VL
  put the loc of btn Button1 into line 2 of fld VL
  set the points of graphic line to fld VL
end mouseStillDown

on mouseUp
  put the mouseLoc into VL2
  set the loc of me to VL2
  put the loc of btn Button into line 1 of fld VL
  put the loc of btn Button1 into line 2 of fld VL
  set the points of graphic line to fld VL
end mouseUp

Still fairly clunky, but a lot better than my first effort. The secret 
lies in the 'mouseStillDown' thing .. . :)


Richmond.

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: handler to connect buttons with a line

2011-10-31 Thread Richmond

if you adjust this:

on mouseDown
  grab me
end mouseDown

to this:

on mouseDown
  grab me
set the idleRate to 1
end mouseDown

you get fairly spiffy results!

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode