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

x
?
Solved

How to Create Popup Menus during Runtime

Posted on 1998-10-26
5
Medium Priority
?
257 Views
Last Modified: 2010-04-30
Does anyone know if it's possible to create Popup menus during Runtime, if the form doesn't have any popup menus at all. and doesn't have a Title.
the form is actually round
  Theos
0
Comment
Question by:JavaJester
5 Comments
 
LVL 6

Expert Comment

by:clifABB
ID: 1441652
Yes, it is possible, but you must have at least one menu already defined.

Create a top level menu called mnuMenu.
Set it's visible property to false
Create a sub menu under this called mnuSub
Set it's index = 0
set it's visible property = false

in your form load, you can add menu items like this:
Private Sub Load()
  Load mnuSub(1)
  mnuSub(1).Caption = "Sub 1"
  mnuSub(1).Visible = True
  Load mnuSub(2)
  mnuSub(2).Caption = "Sub 2"
  mnuSub(2).Visible = True
End Sub

Then you can call the popup menu like this:
Private Sub Form_MouseDown (Button As Integer, Shift As Integer, X As Single, Y As Single)
  If Button = 2 Then
    PopupMenu mnuMenu
  End If
End Sub
0
 
LVL 1

Author Comment

by:JavaJester
ID: 1441653
I Know that but i can't have any menus to begin with cause the form is not square...
and if you put a menu and make it invis it screws up the form shape that i need....
0
 
LVL 15

Accepted Solution

by:
ameba earned 600 total points
ID: 1441654
You can use menu from your other, invisible form (frmPops).

' Add this to your oval form - declarations section
Public menuselected as integer

menuselected = 0
PopupMenu frmPops.mnuMenu' show popup
Select Case menuselected
Case 0 ' nothing selected
    ' do nothing
    msgbox "nothing selected"
Case 1 ' first submenu selected
    ' do something useful
    msgbox "first submenu"
Case 2 ' second submenu selected
    ' do something useful
    msgbox "second submenu"
End Select

in you popup menu_click events use:
frmOval.menuselected=1 ' for first submenu
frmOval.menuselected=2 ...
Move your other code from menu click event to select case code portion in your frmOval.

Don't forget to unload frmPops in Form_unload event of frmOval.
0
 
LVL 15

Expert Comment

by:ameba
ID: 1441655
The code for oval form can be used in MouseUp event of a blue label. If you need clarification, let me know.
0
 
LVL 14

Expert Comment

by:waty
ID: 1441656
On the VBDiamond Website (see my profile), you will find code to create completelly dynamically popup menu at runtime.
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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
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.
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…
Suggested Courses

877 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