Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to Create Popup Menus during Runtime

Posted on 1998-10-26
5
Medium Priority
?
254 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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…
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

688 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