Building a PoupMenu with some “disabled” Rows ?

In a PopupMenu (PM), is it possibe to “grey” (inactivate / set unavailable) Row(s) ?

Day you have 10 Tows and only some of them have the word Date in them: only these will be actives, all other have to be rejected.

I populate the PM in Window Open Event.

OK, I can make the rejection in the Change event like:

[code] // PM’s Change Event
If InStr(Me.Text,“Date”) = 0 Then
// Do nothing if the “Date” word does not exists in the selected Row Text…
// If you want to follow the IDE (bad) Example, add a beep here)
'Beep // No, No More Beep(s) !!!
Else
// Set some code if the Selected Row Text holds the string “Date”

// a. Set the target Column number
mListBox.gDateCol = Me.ListIndex

// b. Fill the User Report TextField
TF_Name_Column.Text = mListBox.gLB.Heading(mListBox.gDateCol)

End If[/code]

I really prefer to have a way to do not let the user choose a wrong entry in the PM.

Someone ?

This will give you an idea how to do it on OS X – put this code into the Open event of a PopupButton:

[code]// Add test rows
For i As Integer = 0 To 10
Me.AddRow("Row " + Str(i))
Next

Declare Sub setAutoenablesItems Lib “AppKit” Selector “setAutoenablesItems:” (NSPopupButton As Ptr, _
value As Boolean)
Declare Function itemAtIndex Lib “AppKit” Selector “itemAtIndex:” (NSPopupButton As Ptr, _
index As Integer) As Ptr
Declare Sub setEnabled Lib “AppKit” Selector “setEnabled:” (NSMenuItem As Ptr, value As Boolean)

Dim indexOfTheItemToDisable As Integer = 3

Dim popupButtonPtr As Ptr = Ptr(Me.Handle)
setAutoenablesItems(popupButtonPtr, False)
Dim menuItem3 As Ptr = itemAtIndex(popupButtonPtr, indexOfTheItemToDisable)
setEnabled(menuItem3, False)// The fourth row labelled “Row3” will show up disabled[/code]

Thanks Eli.