forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Detecting a double click in a %gr region

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+
View previous topic :: View next topic  
Author Message
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 2388
Location: Yateley, Hants, UK

PostPosted: Thu Dec 20, 2007 10:22 pm    Post subject: Detecting a double click in a %gr region Reply with quote

I'm experimenting with a call-back function for a %gr region. Here is the first effort:

INTEGER FUNCTION GR_FN()
CHARACTER*(30) CBR
INCLUDE <WINDOWS.INS>
write (*,*) ' In GR_FN'
CBR = CLEARWIN_STRING@('CALLBACK_REASON')
write (*,*) CBR
IX = CLEARWIN_INFO@('GRAPHICS_MOUSE_X')
IY = CLEARWIN_INFO@('GRAPHICS_MOUSE_Y')
write(*,*) IX, IY
GR_FN = 1
END

I get a MOUSE_LEFT_CLICK both before and after a MOUSE_DOUBLE_CLICK - exactly as stated by the documentation. When I see the initial MOUSE_LEFT_CLICK, how do I determine if that was the user's intention, or is there a MOUSE_DOUBLE_CLICK in the offing? Is there anyone who can help with a snippet of code or an explanation of how they deal with this please?

Eddie
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7916
Location: Salford, UK

PostPosted: Fri Dec 21, 2007 12:11 pm    Post subject: Reply with quote

ClearWin+ is simply relaying to you the mouse events that it receives.

A double click action is transmitted as the first click, then, if the time interval is suitably small, the second click is translated into a double click event.

The design of the user interface should allow for a user's poor attempt at a double click or a faulty mouse button. So a single click event must be either compatible or benign. For example, in an editor, a single click could set a selection whilst a double click extends the selection. In this case the initial single click is applied but is redundant when followed by a second click in rapid succession.

In other words it is not a good idea to make a single click mean something quite different from a double click. The single click event should be implemented anyway and then followed by the double click event.

If you still want to isolate the single click event then you will need to program a timer into your code and set your own tollerance between the two received events. But even then you will have a tricky programming task because you will have to implement an isolated single click retrospectively.
Back to top
View user's profile Send private message AIM Address
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 2388
Location: Yateley, Hants, UK

PostPosted: Sat Dec 22, 2007 2:34 pm    Post subject: Reply with quote

Paul,

It is useful being told that something is difficult, because nothing is more frustrating than programming and debugging something for weeks, only to find out that there is a routine already in existence called something like "get_filtered_mouse_click_and decypher_it@(result)"!

Deciding what a user would find most logical and convenient to do in a specific situation isn't always easy. I think that I'll avoid double-clicks in the short term.

Eddie
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+ All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group