Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Disable Double Click on a menu

Posted on 1998-12-20
7
Medium Priority
?
248 Views
Last Modified: 2010-05-03
In VB3 I have tried to disable a doubleclick on a menu because this menu option is the "Finish" option and as such it unloads the form,  however the the "2nd click" of the double click causes the form to be reloaded.

I have tried to disable the "2nd click" by
1) Immediately disabling the form in the click event
2) Setting up a static variable that exits the sub if the   variable has already set (which it is the first time the    event is entered)
3) used the API command GetInputStatus% & if this is true I have exited the routine without doing any processing at all in the hope that the second click will process the code instead - however the GetInputStatus% returns a false and so this option was not able to be used.

Any Ideas?  Do you even understand the question?
0
Comment
Question by:shek121398
7 Comments
 

Author Comment

by:shek121398
ID: 1451678
Edited text of question
0
 
LVL 2

Expert Comment

by:trillo
ID: 1451679
I read, and read again the questions, but I don't get it... If I understand well, you want to disable a double click on a menu... but Menus can't have a double click event........ ???

Trillo
0
 
LVL 14

Expert Comment

by:Matti
ID: 1451680
Hi!

Declare an integer Variable on global /form level

Set this variable Clicked = false when form loads

but a these lines first in that Click event

Sub AMenu_Click ()
If Clicked = True Then exit sub
Clicked = True

Then put here what you want to do whit the event.
Note! if it is a function call do not use CALL use X% = style because Call does these independently, it don't wait the function be finnish

'Set this variable back again
Clicked = False

End sub


Matti

0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

Author Comment

by:shek121398
ID: 1451681
Matti - sorry this code already exists in the click event.  The problem is that the form is unloaded within this event, and even though the 2nd click of the double click is dumped out of the routine with the exit sub - it's too late because the 2nd click has caused the form to be re-loaded.

I'd like to know of a way (within the click event) of determining if the mouse was really double clicked OR a way of removing all other keystrokes and clicks waiting to be processed on that form.
0
 

Author Comment

by:shek121398
ID: 1451682
Trillo,
Even though a menu doesn't have a double click event - that doesn't stop the user from double clicking does it?  Instead 2 clicks are processed.  If menus had a double click event then life would be easy for me!
0
 
LVL 2

Expert Comment

by:trillo
ID: 1451683
When the user doubleclicks on a control, windows checks if both clicks are within the doubleclick time interval, and if both clicks are within a rectangular area. If so, the Windows interprets it as a double click, otherwise Windows interprets it as two signle mouse clicks..... This means that if the user doubleclicks on a control, the "clcik" event wont' never be fired... This is true for all controls, because every control is a Window, and all windows can recieve single and double clicks. Altough, this is not true for menus, because a menu is one of the few "controls" that is not a window. For menus you can only have a click event...
I'm sorry but I still don't understand some things.... Maybe I'm a little bit idiot:
1) why should the user doubleclick on a menu command... I mean, that's not a standard way of using menus ??
2) If, with the first click, the form is unloaded, Why does it reload on the second click ???

Trillo
0
 
LVL 4

Accepted Solution

by:
chabaud earned 200 total points
ID: 1451684
why just try this ?

Sub mnuFinish_Click ()
   End    'terminate the application
end sub

0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

783 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question