# Shadowing a subclassed control built in property

**URL:** <https://forum.xojo.com/t/shadowing-a-subclassed-control-built-in-property/28048>\
**Category:** General\
**Created:** [November 13, 2015, 9:42am UTC](https://forum.xojo.com/t/shadowing-a-subclassed-control-built-in-property/28048 "2015-11-13T09:42:30Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michel\_Bujardet](https://forum.xojo.com/user_avatar/forum.xojo.com/michel_bujardet/32/252_2.png) [@Michel\_Bujardet](https://forum.xojo.com/u/Michel_Bujardet)\
**Post date:** [November 13, 2015, 9:42am UTC](https://forum.xojo.com/t/shadowing-a-subclassed-control-built-in-property/28048/1 "2015-11-13T09:42:30Z")

</div>

I am working on a custom WebListBox. In order to keep the state of CheckBoxes, I am using a two dimensions area mirroring rows and columns. That works fine, until methods such as AddRow, Remove or insert are used. It would be great to know when these methods are used in order to update the array.

At the moment I am using a timer to periodically update, but that is not very elegant.

Is there any way somehow to override, hook or shadow the built in methods so any time they are called, the array can be updated ?

---

<div class="post-metadata">

**Author:** ![Massimo\_Valle](https://forum.xojo.com/user_avatar/forum.xojo.com/massimo_valle/32/23049_2.png) [@Massimo\_Valle](https://forum.xojo.com/u/Massimo_Valle)\
**Post date:** [November 13, 2015, 1:54pm UTC](https://forum.xojo.com/t/shadowing-a-subclassed-control-built-in-property/28048/2 "2015-11-13T13:54:51Z")

</div>

You can override methods in a subclass.  
Just declare again Addrow in your subclass (with the same arguments of the original method) and then you will end calling your methods.  
In your AddRow, insert Super.Addrow(…) to let the super class to do the original work.

---

<div class="post-metadata">

**Author:** ![Michel\_Bujardet](https://forum.xojo.com/user_avatar/forum.xojo.com/michel_bujardet/32/252_2.png) [@Michel\_Bujardet](https://forum.xojo.com/u/Michel_Bujardet)\
**Post date:** [November 13, 2015, 2:31pm UTC](https://forum.xojo.com/t/shadowing-a-subclassed-control-built-in-property/28048/3 "2015-11-13T14:31:03Z")

</div>

Thank you Massimo.

But it does not seem to work. Or I did not quite understand what you posted.

I have a CustomListBox in which I have added AddRow(Item as String).

When I call `CustomListBox1.Addrow("test")` it does not call my AddRow but the native one.

---

<div class="post-metadata">

**Author:** ![Eli\_Ott](https://forum.xojo.com/letter_avatar_proxy/v4/letter/e/5f8ce5/32.png) [@Eli\_Ott](https://forum.xojo.com/u/Eli_Ott)\
**Post date:** [November 13, 2015, 2:45pm UTC](https://forum.xojo.com/t/shadowing-a-subclassed-control-built-in-property/28048/4 "2015-11-13T14:45:06Z")

</div>

There are two AddRow methods, check the docs. You must override the other one (or both).

---

<div class="post-metadata">

**Author:** ![Michel\_Bujardet](https://forum.xojo.com/user_avatar/forum.xojo.com/michel_bujardet/32/252_2.png) [@Michel\_Bujardet](https://forum.xojo.com/u/Michel_Bujardet)\
**Post date:** [November 13, 2015, 2:53pm UTC](https://forum.xojo.com/t/shadowing-a-subclassed-control-built-in-property/28048/5 "2015-11-13T14:53:55Z")

</div>

Of course. Actually there seems to be only one.

`Addrow(ParamArray Item() as String)` catches `Addrow(String)` as it takes a single string as item(0). My error was to start with the single string item method.

Thank you so much, Massimo 🙂

---

<div class="post-metadata">

**Author:** ![Eli\_Ott](https://forum.xojo.com/letter_avatar_proxy/v4/letter/e/5f8ce5/32.png) [@Eli\_Ott](https://forum.xojo.com/u/Eli_Ott)\
**Post date:** [November 13, 2015, 2:56pm UTC](https://forum.xojo.com/t/shadowing-a-subclassed-control-built-in-property/28048/6 "2015-11-13T14:56:00Z")

</div>

> [@229204:@Michel Bujardet](#):
>
> Actually there seems to be only one.

You are right. I didn’t properly read your OP, so I missed that you were speaking of a WebListbox.

---

<div class="post-metadata">

**Author:** ![Will\_Shank](https://forum.xojo.com/letter_avatar_proxy/v4/letter/w/f475e1/32.png) [@Will\_Shank](https://forum.xojo.com/u/Will_Shank)\
**Post date:** [November 13, 2015, 4:33pm UTC](https://forum.xojo.com/t/shadowing-a-subclassed-control-built-in-property/28048/7 "2015-11-13T16:33:33Z")

</div>

FYI, when you add a method the Method Name field is a combobox that drops down to show all the methods you can override. Select one and the whole signature is filled in for you.

---

<div class="post-metadata">

**Author:** ![Michel\_Bujardet](https://forum.xojo.com/user_avatar/forum.xojo.com/michel_bujardet/32/252_2.png) [@Michel\_Bujardet](https://forum.xojo.com/u/Michel_Bujardet)\
**Post date:** [November 13, 2015, 4:41pm UTC](https://forum.xojo.com/t/shadowing-a-subclassed-control-built-in-property/28048/8 "2015-11-13T16:41:25Z")

</div>

> [@229244:@Will Shank](#):
>
> FYI, when you add a method the Method Name field is a combobox that drops down to show all the methods you can override. Select one and the whole signature is filled in for you.

Great. Very convenient. Thank you.

---

<div class="post-metadata">

**Author:** ![system](https://forum.xojo.com/uploads/default/original/1X/455b4dcc0e61630e9f81940004ddffa49c432a46.png) [@system](https://forum.xojo.com/u/system)\
**Post date:** [October 29, 2020, 6:03pm UTC](https://forum.xojo.com/t/shadowing-a-subclassed-control-built-in-property/28048/9 "2020-10-29T18:03:32Z")

</div>


