Solved

Disable Double Click on a menu

Posted on 1998-12-20
7
234 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

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 100 total points
ID: 1451684
why just try this ?

Sub mnuFinish_Click ()
   End    'terminate the application
end sub

0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

757 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now