?
Solved

Create a VB Menu on an OCX

Posted on 2003-02-24
24
Medium Priority
?
388 Views
Last Modified: 2013-12-25
hi

how can i create a vb menu on a simple activex usercontrol. i created the menu with the vb wizard, but in the runtime or in the design mode, the menu isn't shown. why???

How can i bring a menu on an usercontrol??

PS: i can use the menu, when i create a popup menu, but i want the standard menu on the top
0
Comment
Question by:mamboau
[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
  • 7
  • 6
  • 5
  • +3
24 Comments
 
LVL 5

Expert Comment

by:JMoon5FTM
ID: 8018598
A control's menus will never be displayed at design time.

At run time, make sure the menu items are visible, the form's NegotiateMenus property is set to True, and the control has the focus.
0
 
LVL 3

Expert Comment

by:kokoloko
ID: 8042204
0
 
LVL 5

Expert Comment

by:avya2k
ID: 8063911
U can create Menu with Menu Editor
And in code window in
UserControl_MouseUp()... event
Popup MyMenuName
will popup ur menu
0
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.

 
LVL 5

Expert Comment

by:avya2k
ID: 8063912
U can create Menu with Menu Editor
And in code window in
UserControl_MouseUp()... event
Popup MyMenuName
will popup ur menu
0
 
LVL 5

Accepted Solution

by:
avya2k earned 200 total points
ID: 8063961
To Show the menu on Top U can use the Button on Top Left Corner or Label with The Menu Like Caption (File with F Underscored)
and on click of Label Popup ur menu on location of
x=Label's left and y=label.Top + label.height
0
 
LVL 6

Expert Comment

by:GPrentice00
ID: 9116424
This question has been classified as abandoned.  I will make a recommendation to the moderators on its resolution in approximately one week.  I would appreciate any comments by the experts that would help me in making a recommendation.

It is assumed that any participant not responding to this request is no longer interested in its final deposition.

If the asker does not know how to close the question, the options are here:
http://www.experts-exchange.com/help/closing.jsp

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER

GPrentice00
Cleanup Volunteer
0
 
LVL 5

Expert Comment

by:avya2k
ID: 9119748
A Trick with OCX

''''''''''''''''''''OCX Code'''''''''''''''''''''

Declare one Public Object in OCX Code as
Public mnuOCX as Object

and  in Initialize method

write as

Private Sub UserControl_Initialize()
    Set mnuOCX = a
End Sub


''''''''''''''''''''Form Code'''''''''''''''''''''

Insert the menu in Form say mnuFrm

Private Sub mnuFrm_Click()
    Me.PopupMenu UserControl11.mnuOCX
End Sub

This will surely POPUP OCX Menu
I tried it successfully.


Request
(Can the points be increased to 150 / 200 if my ans is Correct)
Thanks .
0
 
LVL 5

Expert Comment

by:JMoon5FTM
ID: 9164125
mamboau asked about top-level menus, and not pop-up menus.  I am the only one who has posted anything relevant to the problem.  Although my post is short, it clearly outlines the steps necessary for displaying a menu constructed using the UserControl designer.  Thus, I request credit for this one.
0
 
LVL 3

Expert Comment

by:kokoloko
ID: 9173682
well, I don't think my post is "irrelevant" to the problem, as JMoon5FTM says...
In fact the URL I posted gives very good examples of how to create menus on ActiveX Controls

0
 
LVL 5

Expert Comment

by:avya2k
ID: 9179654
I don't think i've posted somthing wrong.
JMoon5FTM , Are you new to VB
I have written the same which  mamboau requires
Just insert any top level menu and onClick action of that you can popup control's menu.
this will work same as inserted menus in form
0
 
LVL 3

Expert Comment

by:kokoloko
ID: 9181341
JMoon5FTM said: "I request credit for this one"

JMoon5FTM, I think you are confused. Experts-exchange is not about 'credit' or 'points'
It's about helping people and learning from that.

I don´t care if the points of a Q go to someone else, as long as I had helped and/or learnt something useful.
0
 
LVL 5

Expert Comment

by:JMoon5FTM
ID: 9292603
Are kokoloko and avya2k illiterate?

Once again, this time quoting mamboau:

"i want the standard menu on the top"

Your posts are about POPUP menus, and the question was about TOP-LEVEL menus.

Maybe you're new to the English language, avya2k.  I have a considerable amount of experience in both English and Visual Basic, neither of which was really needed here.  It was a simple question and I answered it.

And no, kokoloko, I am not confused.  Experts-exchange is about helping people, but it is also about points.  Most experts give preference to questions with high point values, because then, when they have problems that need attention, they can afford to ask questions with high point values, which once again get precedence.  But this question isn't worth many points, and I'm not asking for credit because I need 50 points.  I'm asking for credit because I correctly answered the question, and I deserve it.
0
 
LVL 3

Expert Comment

by:kokoloko
ID: 9296154
JMoon, with all the respect, I think your expressions are not appropiate.
I really don't care how much experience you've got in English or VB as long as you help people solve their problems.
So, "illeterate" and "I have a considerable amount of experience blah, blah" are way out of context here.

Now, regarding the menus, you can emulate menus on top using pop-up menus, so our answers are neither irrelevant nor illeterate.

I think that this Q is getting out of hand, and besides, mambou hasn't showed any reactions, so I'll leave a reccomendation in community support to delete this Q without assigning the points to anyone.

Best regards
Kokoloko


0
 
LVL 3

Expert Comment

by:kokoloko
ID: 9296267
0
 
LVL 5

Expert Comment

by:avya2k
ID: 9300210
JMoon...
what you have told is wrong cause top level menus are only the caller for POPup menus
when you click the top level menu let's say File menu of ur browser then it will popup the submenu of File Menu
and this is only the POPup menu which is aligned at the position of 'File' menubar
But if i called same menu on Right click of mouse then it is called POPup menu
so this make no difference in sub menu and top level menu
so the comments what we have posted are not wrong.
Note: I never argue without Experience.
There is no question of literacy cause i understand what the question is and what should be the answer

what i think is either mamboau wants the menu inside the usercontrol(In usercontrol [not in form ] it should see like file menu or likewise) if this is the case there is the answer too.
but if you want to show the Usercontrol menus in Form Menubar then the  comment which i posted is perfect and also experienced (In JMoon's language.)

0
 
LVL 5

Expert Comment

by:JMoon5FTM
ID: 9340341
1.  New Usercontrol
2.  Tools --> Menu Editor
3.  Create Menus, and set the negotiation positions for the menus - left, middle, or right
4.  New form
5.  Insert usercontrol
6.  Make sure form.NegotiateMenus is True
7.  Run the form

VB treats menus on usercontrols the same way it does on things like Word documents - the usercontrol's menus will only appear if the usercontrol has the focus.  It's not the greatest design, but it works fine if the usercontrol is the only control on the form that can take focus, or if you don't mind losing the menus when the user clicks something else.
0
 
LVL 5

Expert Comment

by:JMoon5FTM
ID: 9340383
Lunchy, I'm sorry for making unprofessional comments on Experts-Exchange.  I was frustrated at trying to explain, over and over, just what you said in your first sentence - that we were talking about top-level menus.  In my frustration, I interperted avya2k's "Are you new to VB?" as an insult and I responded inappropriately.

Sorry to avya2k and kokoloko too for blowing up.

As I said on 9/4/03, I'm no longer interested in the points of it.  But what I've posted works.
0
 
LVL 2

Expert Comment

by:Lunchy
ID: 9340537
No problem for the language.  It happens sometimes and thanks for the apology.

When I follow your instructions, the menu shows up on the form, not on the usercontrol...
0
 
LVL 5

Expert Comment

by:JMoon5FTM
ID: 9340623
I thought that was the deal - "i want the standard menu on the top".

If not, what you said about being impossible in "honest" VB definately applies.  Actually putting the menu on the control would require attatching the menu via the Windows API.  Before you did that, however, you'd either have to guess at the menu id VB is using or create the menu itself entirely through API.

Still, I'd do the impossible before I'd settle for avya2k's solution, because I can't move between menus with the keyboard with what he said.  But I guess not everyone is as attatched to their keyboards as I am.
0
 
LVL 5

Expert Comment

by:avya2k
ID: 9342307
I think you should have a look whole PS:...

It says i can use the menu, when i create a popup menu i.e. He had tried inserting menu on form already.

PS: i can use the menu, when i create a popup menu, but i want the standard menu on the top.


and what is 'Points for JMoon5FTM'

0
 

Author Comment

by:mamboau
ID: 9353605
hi there

I'm surprised for the lot of answers to my question... sorry, that I dont reply earlier!

I had found a reason for the menu problem. I had buyed the ACTIVE BAR 2 from DataDynamics!!!
It's a very useful and helpful tool! It's great to creat menus, but also problems with refreshing of forms occured...

so what...

greetinx, and hope this post is now finished :)

0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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…
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…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month8 days, 18 hours left to enroll

765 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