Custom Canvas PopupMenu and Computed Properties

I am trying to create my own PopUpMenu control as a canvas subsclass and would like to replicate the RowTag(i) Get/Set call using a computed property but am not sure how.

Right now I am just using a SetRowTag(index As Integer) method to set, and RowTag(index As Integer) for get but I would like to be able to set using CustomMenu.RowTag(i) = “Hello”.

Is this possible and if so how do I achieve this?


You need two methods:

Sub RowTag(index As Integer, Assigns value As Variant) ... End Function RowTag(index As Integer) As Variant ... End
The Assigns keyword will let you use the “setter” method as an assignment statement.

Thanks, Eli. Would I still require RowTag computed property (Get/Set) or would these methods replace it and instead I would create a different regular property with a different name and then set or get this property value in the above methods?


Replace your computed property with the pair of methods

That’s fantastic. Thank you.