Hi All,
I'm trying to work out how to disable a single item on a popup menu. Let me start from the begininning.
I've got a form with a treeview attached. When a record is selected using right-click on the menu TreeView, a popup menu appears. Depending on the state of the record on the treeview, I want to manipulate the popup menu items.
For example assume there are 4 possible child records that the parent can have (sorry, bit of a fruit theme going on!):
a) Apricots
b) Bananas
c) Crunchy Apples
d) Delicious Plums
Assuming "George" (the parent record) has already had "Delicious Plums", I either do not want to display this option or disable this option on the list.
I've spent a number of hours searcing my good friend google and the best he can come up with is:
and the CommandbarEnable function:
Has anyone got any thoughs on this??
Many thanks in advance for any time you spend on this,
Fitz
Did you know, there are 10 types of people in this world:
* Those who understand binary
and
* Those who Don't!!
I'm trying to work out how to disable a single item on a popup menu. Let me start from the begininning.
I've got a form with a treeview attached. When a record is selected using right-click on the menu TreeView, a popup menu appears. Depending on the state of the record on the treeview, I want to manipulate the popup menu items.
For example assume there are 4 possible child records that the parent can have (sorry, bit of a fruit theme going on!):
a) Apricots
b) Bananas
c) Crunchy Apples
d) Delicious Plums
Assuming "George" (the parent record) has already had "Delicious Plums", I either do not want to display this option or disable this option on the list.
I've spent a number of hours searcing my good friend google and the best he can come up with is:
Code:
....
'Called to disable the toolbar
Call CommandbarEnable(CommandBars("xxPopupMenu"), False, 1, 4)
and the CommandbarEnable function:
Code:
Function CommandbarEnable(Cmdbar As CommandBar, _
CmdbarEnabled As Boolean, TopLevel As Integer, _
Optional Sublevel As Integer)
Dim SubCommandbar
On Error GoTo Err_CommandBarEnable
If Cmdbar.Visible = False Then Cmdbar.Visible = True
If IsMissing(Sublevel) Or Sublevel = 0 Then
Cmdbar.Controls(TopLevel).Enabled = CmdbarEnabled
Else
Set SubCommandbar = Cmdbar.Controls(TopLevel)
SubCommandbar.Controls(Sublevel).Enabled = CmdbarEnabled
End If
Exit_CommandBarEnable:
Exit Function
Err_CommandBarEnable:
MsgBox "Error " & CStr(Err) & " " & Err.Description & _
" has occurred in the CommandBarEnable Function", vbOKOnly, _
"Error Detected"
Resume Exit_CommandBarEnable
End Function
Has anyone got any thoughs on this??
Many thanks in advance for any time you spend on this,
Fitz
Did you know, there are 10 types of people in this world:
* Those who understand binary
and
* Those who Don't!!