Right Mouse Click in RunRev

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
saratogacoach
Posts: 87
Joined: Thu Jul 17, 2008 8:42 pm

Right Mouse Click in RunRev

Post by saratogacoach » Thu Jun 04, 2009 10:30 pm

Hi,

As a beginner, I've been searching for how to code a right mouse click for a Windows project, but haven't found it. I am guessing it has to do with handlers and somehow passing a code to activate right click, but this is where I get lost.

(In the project, the user inserts text entry fields to type text into. I need to code this to make the text entry fields draggable on mouse down. Problem is that text entry fields have a flashing cursor for text entry so mouse down is already in use. The only solution I can think of is to use a right click for enabling drag/drop for text entry fields? The project is more fully described in posting: http://forums.runrev.com/phpBB2/viewtopic.php?p=14399 )

Any leads would be greatly appreciated.

Kind Regards,
saratogacoach
LiveCode 4.6.0, Windows 7 Home Premium 64 bit, Core i7 2.80, 8G RAM, ATI Radeon HD5770

grc
Posts: 13
Joined: Thu Apr 23, 2009 9:21 am

Post by grc » Thu Jun 04, 2009 10:53 pm

Not sure about right click, but how would double click do?

on mouseDoubleDown (sent when the user double clicks). Maybe double click then drag the field.

on mouseDoubleUp. Maybe double click then have the field follow your mouse till you click once.

Hope it helps :)

Grc

saratogacoach
Posts: 87
Joined: Thu Jul 17, 2008 8:42 pm

Post by saratogacoach » Thu Jun 04, 2009 11:06 pm

Thanks, grc.

I gave this a try, but could not get it to work:

Code: Select all

set the script of the templatefield to "on mouseDoubleDown" & CR & "grab me" & CR & " end mouseDoubleDown"
By the way, is there a drag command that could be used?

or

Is there a way to select the text entry fields, then drag them?

Kind Regards,
saratogacoach
LiveCode 4.6.0, Windows 7 Home Premium 64 bit, Core i7 2.80, 8G RAM, ATI Radeon HD5770

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

Post by bn » Thu Jun 04, 2009 11:39 pm

Saratoga,

that is a little tricky since an editable field does not get mouseDown, mouseUp etc. A locked field does though.

For a locked field you could say as in the images

Code: Select all

on mouseDown
  grab me
end mouseDown
for an editable field you could put something into the script of the field like this:

Code: Select all

on mousewithin
   if the optionkey is down then
      set the loc of me to  the mouseloc
   end if
end mousewithin
The optionkey is the Alt-key on windows. That is not as smooth as the grab but gets you there.
BTW regarding right click: whenever you do a handler like

Code: Select all

on mouseUp
  dosomething
end mouseUp
you have a parameter passed to the mouseUp that indicates the type of click

documentation:
The mouseButtonNumber specifies which mouse button was pressed:

* 1 is the mouse button on Mac OS systems and the left button on Windows and Unix systems.
* 2 is the middle button on Unix systems.
* 3 is the right button on Windows and Unix systems and Control-click on Mac OS systems.
so

Code: Select all

on mouseUp mouseButtonNumber
  if mouseButtonNumber = 1 then do leftclickstuff
  if mouseButtonNumber = 3 then do rightclickingstuff
end mouseUp
regards
Bernd
P.S. Do you have an example site on the web that shows the kind of genogram you have in mind?

saratogacoach
Posts: 87
Joined: Thu Jul 17, 2008 8:42 pm

Post by saratogacoach » Fri Jun 05, 2009 12:18 am

Hi Bernd,

Thanks for your continued help.

I kept working on a solution to dragging the text entry field, until, while experimenting, I noticed that these fields, using the code:

Code: Select all

set the script of the templatefield to "on mouseDown" & CR & " grab me" & CR & "end mouseDown"
will drag using right mouse down (in Windows).

No explanation, but it works. (Perhaps others can try it out, test this.) But, I think this is solved.

Now, I need to add line drawing: the user needs to be able to draw connecting lines (for example, solid, straight lines) between images (images are used as symbols for family members).

These inserted lines will also need to have handles on their ends, so the user can grab a handle and lengthen or shorten or rotate a line to fit between images/symbols. Plus ability to grab and drag the line wherever needed. Similar to inserted images and inserted text entry fields, inserted lines need to be named and have incrementing (+1) numbering (so each line that is created will have a unique name).

I've created a new posting for help with line drawing:

http://forums.runrev.com/phpBB2/viewtop ... 4427#14427

Examples of pedigrees and genograms

I uploaded an illustration (png file) which gives an example of a (fictional) family pedigree which could be drawn to track health conditions.

http://www.elearningprojects.com/Pedigree2.png

Genograms are a little different: they use a variety of different connecting lines, in addition to solid lines, like dotted, arrow-headed, etc. (about 12-15 different types). These genogram lines are used to symbolize different types of reltaionships between family members.

Here's an example of a genogram with a few of the family members having labels for (fictional) names:

http://www.elearningprojects.com/genogram2.png

Again, thanks.
saratogacoach
LiveCode 4.6.0, Windows 7 Home Premium 64 bit, Core i7 2.80, 8G RAM, ATI Radeon HD5770

Post Reply