The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
 All Forums
 Origin Forum for Programming
 Forum for Origin C
 Mouse clicks

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
Mike Buess Posted - 05/28/2005 : 10:52:20 AM
Origin Version (Select Help-->About Origin): 7.5 SR5
Operating System: XP

I have a DialogBuilder toolbar and am looking for ways to trigger alternative button actions without using modifier keys (e.g., a button does A on click and B on Ctrl+click). The right mouse button will not activate a toolbar button but one can tell whether or not the right button is depressed during a left-click with GetKeyState(MK_RBUTTON). Unfortunately, it's rather awkward to use both mouse buttons simultaneously. Furthermore, when the right MB is pressed the first left-click is ignored so two left-clicks are needed to activate the toolbar button. (As long as you hold the right MB down all subsequent left-clicks are registered.) It occurred to me that I could dispense with the right MB if double-clicks could somehow be distinguished from single-clicks. Is that possible with OC? If not, is it possible to delay a script or OC function for a short period of time (say 0.5 seconds) and register that a second click has occurred in that interval? Perhaps using the timerproc macro?

Any alternatives that do not involve the keyboard are welcomed.

I found a tentative solution using the timerProc macro...

[Toolbar.Btn.OnClick]
if( timerFlag==0/0 ) {
timerFlag=0;
def timerProc {
timer -k;
del -v timerFlag;
ty Execute A; // action on single-click
};
timer 0.3;
};
else {
timer -k;
del -v timerFlag;
ty Execute B; // action on double-click
}

The timer interval (0.3 seconds for my reactions and PC) will need to be adjustable by the user but that's probably OK. But I'd still to hear about alternative solutions.

Mike Buess
Origin WebRing Member

Edited by - Mike Buess on 05/28/2005 12:01:36 PM
1   L A T E S T    R E P L I E S    (Newest First)
Mike Buess Posted - 05/29/2005 : 09:48:11 AM
Windows' double-click speed (in milliseconds) can be obtained from the registry with OC so the following approach works fine for standard mice. However, mice with their own drivers (Kensington and others) might not store their settings in the same place so I'm still open to alternatives. For example, can DialogBuilder buttons be programmed to respond to right-clicks?
// Origin C function
double GetDoubleClick()
{
Registry reg(HKEY_CURRENT_USER);
string dblClick;
reg.GetValue("Control Panel\\Mouse", "DoubleClickSpeed", dblClick);
return atof(dblClick)/1000;
}

// LabTalk button script
[Toolbar.Btn.OnClick]
if(DoubleClickSpeed==0/0) DoubleClickSpeed = GetDoubleClick();
if( timerFlag==0/0 ) {
timerFlag=0;
def timerProc {
timer -k;
del -v timerFlag;
ty Execute A; // action on single-click
};
timer DoubleClickSpeed;
} else {
timer -k;
del -v timerFlag;
ty Execute B; // action on double-click
};


Mike Buess
Origin WebRing Member

Edited by - Mike Buess on 05/29/2005 09:49:45 AM

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000