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

x
?
Solved

Menu Editor Question

Posted on 2004-10-18
6
Medium Priority
?
412 Views
Last Modified: 2010-07-27
I am trying to build a popup menu, using menu editor, I have:

                  Caption          Name            Index
Qnty:             Qnty            mnu1             0
......1               1               mnu1            1
......2               2               mnu1            2
......3               3               mnu1            3


I am getting error when I want to save above setting.  The error is:  "Menu control elements must be contiguous and with the same submenu".  This is follow up work from question at:

http://www.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/Q_21164566.html

Also, I don't want this menu to show up on the top of the form; rather to pop up on a right-click on a control (see above link for codes I have).

Thanks,  
0
Comment
Question by:Mike Eghtebas
[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
  • 3
  • 2
6 Comments
 
LVL 17

Accepted Solution

by:
zzzzzooc earned 1600 total points
ID: 12340732
You can't index a menu and it's sub-menus. You have to give the menu one name without an index, then use the same names for the sub-menus and index those.

Example:
-------------------------------------------------------
                 Caption          Name            Index
Qnty:             Qnty            mnu1            
......1               1               mnu1_            0
......2               2               mnu1_            1
......3               3               mnu1_            2
0
 

Assisted Solution

by:Sergio_A
Sergio_A earned 400 total points
ID: 12341550
Well... first of all, you only can display a popup menu over a MDIForm or a simple Form.
This is the method you must Use:

Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Call Me.PopupMenu(menuname, flags, x, y, boldcommand)
End Sub

a simple trick you can use is putting this method - replacing "Me" with the name of the current Form - in a mouseDown command of the control where you can show the submenu. Then, you can set the X,Y arguments of the method with the desired coordinates (eg. the Control left and top values)

The problem with your code refering the menu is that you can't put the same name to the submenu-subitems as the main menu. Change this code to this:

                  Caption          Name            Index
Qnty:             Qnty            mnu0            
......1               1               mnu1            1
......2               2               mnu1            2
......3               3               mnu1            3


if Qnty is the only menu with the "mnu0" name, dosn't have to have index. It's same as an control array.

Let me know your results.... Cya
0
 
LVL 34

Author Comment

by:Mike Eghtebas
ID: 12347113
Hi Sergio,

I appreciate your good answer.  The solution from zzzzzooc was first correct answer nevertheless.  For additional info you have included in:

PopupMenu(menuname, flags, x, y, boldcommand)

I split the points (100 out of 500) for you.  My understanding from this code is:

flags:?    <-- menue title?
x, y: Are these parameters to open the menu at a desired location?
boldcommand: Does this constant make menu captions appear bold?
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Expert Comment

by:Sergio_A
ID: 12358180
Well, those flags are optional, so you can put only the things you are interested in, and yes, X,Y are the params to open the menu in the desired location. Your code should look like this:

frmMe.PopupMenu("mnu0",,cmdAdd.left,cmdAdd.top)

I think this could work for You...
Greetings!!
0
 

Expert Comment

by:Sergio_A
ID: 12358206
I forgot to tell you that frmMe can be replaced by only "ME" or the name of your form.
0
 
LVL 34

Author Comment

by:Mike Eghtebas
ID: 12361567
Thank you Sergio,

Mike
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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…
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…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…
Suggested Courses

722 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