|
-
Aug 22nd, 2000, 09:26 PM
#1
Thread Starter
Hyperactive Member
Hi,
I have a popup menu in my app. It works, but not the way like other popup menus in Explorer or other windows apps.
Basically when the popup menu is open I can't right-click somewhere else on the form and re-display that menu at mouse point. I have to either left-click one of the menu options or left-click somewhere else to make the menu dissapear and then when the menu is off I can right-click again to make it re-apear.
Example:
Let's say, you're on windows desktop. No matter how many times you right-click, a NEW menu pops up at current mouse position. You don't have to close it, you just right-click again somewhere else and the current menu closes and the new one appears. I want the same thing in my app.
Thanks for your help.
-
Aug 22nd, 2000, 09:49 PM
#2
Fanatic Member
you can set a right mouse button setting to click. I'm confushing myself, but this will let the right mouse button do what you want! this is a flag in the popupmenu function
GWDASH
[b]VB6, Perl, ASP, HTML, JavaScript, VBScript, SQL, C, C++, Linux , Java, PHP, MySQL, XML[b]
-
Aug 23rd, 2000, 06:08 AM
#3
Thread Starter
Hyperactive Member
-
Aug 23rd, 2000, 06:11 AM
#4
Fanatic Member
I think this is always so in a VB program. Maybe if you create the menus with the API the problem is solved. I'm sure V(ery) Basic will give you his menu example that uses the API if you ask him.
-
Aug 23rd, 2000, 06:45 AM
#5
Fanatic Member
Unfortunately, my app doesn't do that yet. But, as always, I will respond to consumer demands and subclass mouse events.
Rest assured I will die trying. Well, metaphorically. Maybe not even that.
-
Aug 23rd, 2000, 08:15 PM
#6
Fanatic Member
no, vb is set for leftbuttondefault. I've giving this tip to someone else, it works for him. in the PopupMenu Function, set the flags to vbRightButtonDefault (or something like that, use MSDN)
GWDASH
[b]VB6, Perl, ASP, HTML, JavaScript, VBScript, SQL, C, C++, Linux , Java, PHP, MySQL, XML[b]
-
Aug 23rd, 2000, 09:00 PM
#7
It's actually vbPopupMenuRightButton gwdash, but the idea of what you were talking about works. Here's an example:
Code:
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 2 Then PopupMenu mnupopup, vbPopupMenuRightButton
End Sub
-
Aug 24th, 2000, 03:46 AM
#8
Fanatic Member
Does anybody know how VB does that? Because Windows doesn't send any mouse messages while a menu is up, so how can it tell when a button has been clicked?
If somebody has any ideas, please say, because I'd like to add this functionality to my project.
Thank you,
El Maestro
-
Aug 24th, 2000, 05:45 PM
#9
V(ery) Basic, you could do something like this:
Code:
Dim clicked As Integer
Private Sub Form_Load()
clicked = 0
End Sub
Private Sub Command1_Click()
clicked = 1
End Sub
Private Sub Command2_Click()
If clicked = 1 Then MsgBox "Command1 has been clicked!", vbCritical
End Sub
-
Aug 25th, 2000, 03:46 PM
#10
_______
<?>
Code:
'code is compliments of ameba at ExpertsExchange
'make a popup menu just like the one's in windows
'appear at the right click of your mouse as long
'as your right click is on the form
Option Explicit
Private Sub Form_Load()
mnuPop.Visible = False
End Sub
'
'allow users the ability of win keyboard menu key
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 93 Then
'fire up the popup menu
PopupMenu mnuPop, 2, 60, 60
End If
End Sub
Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbRightButton Then
'fire up the popup menu
PopupMenu mnuPop, 2, X, Y
End If
End Sub
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Aug 25th, 2000, 05:57 PM
#11
Fanatic Member
So that means that if I show the menu when the mouse button is released, then it'll receive mouse messages.
For a change that makes sense!
Thanks, but why did he say 'Joe'?
Gee. It's getting a little late now so I'd better go. Thanks,
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|