By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,501 Members | 2,850 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,501 IT Pros & Developers. It's quick & easy.

Context Menu

P: n/a
Hi!

I need to change form's standard context menu code.
Eg. I want to order records by my own code.

Can I make it, or must I create other context menu
and link it to my form??

I'd like to know also how to enable/disable contextmenu's
items ;)

Thanx a lot, Leon!
Nov 12 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Hi,

On Sun, 28 Dec 2003 23:05:55 +0100, Leon wrote:
I need to change form's standard context menu code.
Eg. I want to order records by my own code.

Can I make it, or must I create other context menu
and link it to my form??
The common approach would be to create your own CommandBar and use that.
Use the form's (or a control's) property-sheet to set the "Shortcut Menu
Bar"-property.
I'd like to know also how to enable/disable contextmenu's
items ;)


Below is a function I am using to update a bar's items all at once (check
for line-breaks).
The easiest way to call it will be to use the ShortcutMenuBar-property
directly:

MenuItems_Dis_Enable lstBox.ShortcutMenuBar, _
1, True, _
2, True, _
3, False,

The above sample targets the bar being used with the control "lstBox"
(whatever name that may be) and sets the enabled-prop of the first three
items (1, 2, 3). See the OH for "CommandBars Collection Object" for more
detailed info.

Cheers,
Olaf [MVP]
--
My .02: www.Resources.IntuiDev.com
'dis-/enable items within menus
Function MenuItems_Dis_Enable(strMenuName As String, ParamArray pvarIndx())
'*******************************************
'Name: MenuItems_Dis_Enable (Function)
'Purpose: dis-/enable single entries within commandbars/shortcut-menus
etc.
'Author: Olaf
'Date: October 29, 2001, 06:43:23
'Called by:
'Calls:
'Inputs: strMenuName: name of menu
' varIndx(): (Parameter-array): Index of MenuItem
plus True/False (as variant)
'
'Note: Indexes of commandbars start out at 1!
'Output: -
'*******************************************
Dim intCounter As Integer

With CommandBars(strMenuName)
For intCounter = 0 To UBound(pvarIndx) Step 2
.Controls(pvarIndx(intCounter)).Enabled =
CBool(pvarIndx(intCounter + 1))
'Debug.Print .Controls(pvarIndx(intCounter)).Caption & " -> ";
..Controls(pvarIndx(intCounter)).Enabled
Next intCounter
End With
End Function
Nov 12 '05 #2

P: n/a
;)
Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.