Subset a BevelButton

if there a way to capture when a property is set/changed.
If the user alters the caption of a Bevel Button, I need to be able to capture that event and analyze the new title

if it were a Custom Property I would be able to use SET/GET

If you implement a Computed Property for a built in property your implementation is used, this should allow you to capture and analyze the new title and raise any events you want to.

just be careful with it as you can run into issues doing this

I understand what you mean, just not sure how to implement it without a catch-22


me or tim ?

actually, it is a non-issue… just realized that the control is “private” so I can add my own property that maniupluates the parent using a computed property…

but still for future an example of both would be good (if not for me, now, perhaps for someone else later)


create a subclass
create your own computed property that is the same type & name as the one in the superclass you want to shadow
in the getter to “get” the real one you have to cast to the superclass

        return <SuperClassType>(self).Property
    end get

In the setter you set using a similar technique

       <SuperClassType>(self).Property = value
    end get

Now the thing to be aware of when you do this
if you have code that prods this control and the declared type of the property/local etc is the Supertype then your computed wont be called
If the type of the variable is the custom type then it will

For instance suppose we have a subclass of bevelbutton and we’ve implemented “Caption” as

Public Property Caption as string
    return BevelButton(self).Caption
  End Get

    BevelButton(self).caption = value
  End Set

End Property

then somewhere else we have and instance on a layout and in we have code like the following else where (in a method, event etc on that layout)

  dim b as bevelbutton = CustomBevelButton1

  b.Caption = "bevel" // THIS ONE WONT call you setter code !!!!!!!
  dim b1 as CustomBevelButton = CustomBevelButton1
  b1.Caption = "custom" // this one will call your custom setter

In this case the DECLARED TYPE, not the runtime type, is important

Hence why shadowing is a bad idea as you get weird hard to track bugs

Got it… thanks for the example… I almost had that myself…
but instead of

BevelButton(self).caption =

I tried

Super.caption = 

Super doesnt work for properties (computed or not)

yeah I noticed… today my brain has been off (stress… job seeking, we lost our dog a few days ago … etc) so Casting didn’t even cross my mind…


There have been some postings on the Pro board seeking people

Sorry to hear about the dog ?
Dont look forward to that day with ours