Link to home
Start Free TrialLog in
Avatar of mamboau
mamboau

asked on

Create a VB Menu on an OCX

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
Avatar of JMoon5FTM
JMoon5FTM

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.
Avatar of avya2k
U can create Menu with Menu Editor
And in code window in
UserControl_MouseUp()... event
Popup MyMenuName
will popup ur menu
U can create Menu with Menu Editor
And in code window in
UserControl_MouseUp()... event
Popup MyMenuName
will popup ur menu
ASKER CERTIFIED SOLUTION
Avatar of avya2k
avya2k

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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:
https://www.experts-exchange.com/help/closing.jsp

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER

GPrentice00
Cleanup Volunteer
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 .
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.
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

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
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.
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.
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


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.)

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.
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.
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...
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.
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'

Avatar of mamboau

ASKER

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 :)