Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Exit from a popup menu

Status
Not open for further replies.

seba18

Programmer
Jul 26, 2004
38
I've made an application, ande when I rightclick on the system-tray icon a menu opens as a popup menu.I can close this menu only clicking an option from the menu or clicking anywhere inside the application form. How can I close the menu pressing Escape or clicking outside the menu? How can I get the mouse-buttons state?

And I have one more question:can I put bold text in a VB6 application menu?How?

Thank you!
(please excuse my English)
 
1. Build a menu for the form
2. On the main form menu (each form can only have one menu object) add the menu you want for the "popup"
3. Make the Root of this menu's visible = false
4. add all submenus you want options for under this menu..
5. use the forms MouseUp event to find out if you have a right click event
6. if you do call the Form's Popup method passing the root of our menu as an argument... (look up help on the popup method and you should get some good examples)

(in the case of the code snip all submenu's exist below a menu called maimmenu)

Code:
Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If Button = vbRightButton Then
        Me.PopupMenu MainMenu
        mSubMenu1.Checked = True
    End If
End Sub

You can't (that I have found) make a menu's text bold, however you can make it obvious by marking it as checked..

HTH


Rob
 
Look into the destroymenu api to get rid of the menu in the system tray.

Matt
 
MattSTech, can you give me please more details? I'm still a beginer in VB and I don't know how to do that

Thank you for your help
 
>You can't (that I have found) make a menu's text bold

You may want to read this thread: thread222-895893
 
Sorry for the delay. There have been several threads on this subject. This one doesn't offer the solution but strongm's answer suggests a timer... Perhaps this is the best way to solve the "feature".

Take Care,

Matt
 
Thank's for sugestions!

One more question:how can I add icons near the text in a popup menu?
 
look on this forum for adding bitmapsto a menu.

Take care,

Matt
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top