# Listbox Subclass Q

**URL:** <https://forum.xojo.com/t/listbox-subclass-q/67040>\
**Category:** General\
**Created:** [November 27, 2021, 12:44pm UTC](https://forum.xojo.com/t/listbox-subclass-q/67040 "2021-11-27T12:44:22Z")\
**Posts on this page:** 9\
**Page:** 2

<div class="post-metadata">

**Author:** ![Rick\_Araujo](https://forum.xojo.com/user_avatar/forum.xojo.com/rick_araujo/32/251_2.png) [@Rick\_Araujo](https://forum.xojo.com/u/Rick_Araujo)\
**Post date:** [November 28, 2021, 11:53am UTC](https://forum.xojo.com/t/listbox-subclass-q/67040/22 "2021-11-28T11:53:16Z")

</div>

Things can get worse if I change the test to API2. Changed the class to descend from DesktopListbox instead of Listbox, Now it doesn’t fire even once as before.

 ![image](https://forum.xojo.com/uploads/default/original/2X/9/9d29057fdb2c4291caa868fc21c98abb6daed398.png)

Edit: Not really. The IDE removed my instance from the Window. Need to insert it again…

Remade it. Same behavior.

 ![image](https://forum.xojo.com/uploads/default/original/2X/4/486388f25508e5cda728486c97d4f9255bc8c61f.png)

---

<div class="post-metadata">

**Author:** ![Johann\_Kienbrandt](https://forum.xojo.com/user_avatar/forum.xojo.com/johann_kienbrandt/32/2528_2.png) [@Johann\_Kienbrandt](https://forum.xojo.com/u/Johann_Kienbrandt)\
**Post date:** [November 28, 2021, 11:58am UTC](https://forum.xojo.com/t/listbox-subclass-q/67040/23 "2021-11-28T11:58:29Z")

</div>

![Screen Shot 2021-11-28 at 18.39.06](https://forum.xojo.com/uploads/default/original/2X/a/a866815b07e68cfc8c298117b1d35d769889a261.jpeg)

create container control with a listbox.  
add user definition ueCellTextPaint to listbox

in the listbox CellTextPaint definition add the code: ueCellTextPaint

whenever CellTextPaint is called it will call your user event ueCelltextPaint.

use this container control in a window, and call it lets say ‘lbGroups’.  
in this container control now you can select the user definition ueCelltextPaint and put some code in it.

hope it makes more sense now …  
I mean by userEvent = user definition

---

<div class="post-metadata">

**Author:** ![Rick\_Araujo](https://forum.xojo.com/user_avatar/forum.xojo.com/rick_araujo/32/251_2.png) [@Rick\_Araujo](https://forum.xojo.com/u/Rick_Araujo)\
**Post date:** [November 28, 2021, 12:00pm UTC](https://forum.xojo.com/t/listbox-subclass-q/67040/24 "2021-11-28T12:00:38Z")

</div>

I think we need a FB Case. I can’t find any explanation for such behavior on 2021 R3.

---

<div class="post-metadata">

**Author:** ![Jeff\_Tullin](https://forum.xojo.com/user_avatar/forum.xojo.com/jeff_tullin/32/693_2.png) [@Jeff\_Tullin](https://forum.xojo.com/u/Jeff_Tullin)\
**Post date:** [November 28, 2021, 12:13pm UTC](https://forum.xojo.com/t/listbox-subclass-q/67040/25 "2021-11-28T12:13:34Z")

</div>

> add user definition ueCellTextPaint to listbox
> 
> in the listbox CellTextPaint definition add the code: ueCellTextPaint
> 
> whenever CellTextPaint is called it will call your user event ueCelltextPaint.

Thats clear, and thats why it makes no sense.  
if I call the parents ueCelltextPaint in CellTextPaint, there is no point having the class.  
I may as well just put my special code there.

What I need to happen is  
Class CellTextPaint event happens, and MAY require return true  
Then Listbox normal event fires, and returns true if the class did.  
We are now having two conversations, however, so Im dropping my class idea.

---

<div class="post-metadata">

**Author:** ![Rick\_Araujo](https://forum.xojo.com/user_avatar/forum.xojo.com/rick_araujo/32/251_2.png) [@Rick\_Araujo](https://forum.xojo.com/u/Rick_Araujo)\
**Post date:** [November 28, 2021, 12:14pm UTC](https://forum.xojo.com/t/listbox-subclass-q/67040/26 "2021-11-28T12:14:12Z")

</div>

Seems working. And the bug is really at DebugLog ?

 ![image](https://forum.xojo.com/uploads/default/original/2X/2/2a88bf75c7504cf2b808315818634a877cc318f8.png)

 ![image](https://forum.xojo.com/uploads/default/original/2X/8/8a3d152ab504ce6ecc2620861cb755fe0bc256ef.png)

---

<div class="post-metadata">

**Author:** ![Rick\_Araujo](https://forum.xojo.com/user_avatar/forum.xojo.com/rick_araujo/32/251_2.png) [@Rick\_Araujo](https://forum.xojo.com/u/Rick_Araujo)\
**Post date:** [November 28, 2021, 12:31pm UTC](https://forum.xojo.com/t/listbox-subclass-q/67040/27 "2021-11-28T12:31:00Z")

</div>

Everything fine, except DebugLog failing.

Instance definition:

 ![image](https://forum.xojo.com/uploads/default/original/2X/2/2aac175f0c6943ae01a3bb0422acbb757c93b6c8.png)

Class definition:

 ![image](https://forum.xojo.com/uploads/default/original/2X/c/cbc2f5b13b89eb81160934125e5dff22bc2ecbb3.png)

 ![image](https://forum.xojo.com/uploads/default/original/2X/4/4ec21277cd7c2a1d7d0ae3e62d5a92b04f92c5bf.png)

Edit; Even DebugLog is working, it’s just hiding the contents. If you click at the scrollbar, it shows.

 ![image](https://forum.xojo.com/uploads/default/original/2X/1/1682c61806d29f967936557352b446d600ee46c1.png)

---

<div class="post-metadata">

**Author:** ![Rick\_Araujo](https://forum.xojo.com/user_avatar/forum.xojo.com/rick_araujo/32/251_2.png) [@Rick\_Araujo](https://forum.xojo.com/u/Rick_Araujo)\
**Post date:** [November 28, 2021, 1:14pm UTC](https://forum.xojo.com/t/listbox-subclass-q/67040/28 "2021-11-28T13:14:31Z")

</div>

Now the only thing to care is how to process the overridden class CellTextPaint event, prior or post the bubbled up event.

Process and bubble up:

```auto
DoAnything()
Return RaiseEvent CellTextPaint(g, row, column, x, y)

```

or bubble up, and abort if signaled to:

```auto
If RaiseEvent CellTextPaint(g, row, column, x, y) Then Return True
DoAnything()

```

---

<div class="post-metadata">

**Author:** ![DerkJ](https://forum.xojo.com/letter_avatar_proxy/v4/letter/d/e495f1/32.png) [@DerkJ](https://forum.xojo.com/u/DerkJ)\
**Post date:** [November 29, 2021, 6:49am UTC](https://forum.xojo.com/t/listbox-subclass-q/67040/29 "2021-11-29T06:49:58Z")

</div>

In order for this event handler to be called, the cell itself must have been given a value, even if it is blank

[https://documentation.xojo.com/api/deprecated/listbox.html#listbox-celltextpaint](https://documentation.xojo.com/api/deprecated/listbox.html#listbox-celltextpaint)

Just a note, may still be a bug since there is content we know.

---

<div class="post-metadata">

**Author:** ![Rick\_Araujo](https://forum.xojo.com/user_avatar/forum.xojo.com/rick_araujo/32/251_2.png) [@Rick\_Araujo](https://forum.xojo.com/u/Rick_Araujo)\
**Post date:** [November 29, 2021, 11:03am UTC](https://forum.xojo.com/t/listbox-subclass-q/67040/30 "2021-11-29T11:03:25Z")

</div>

It was, I preset it with content in the properties inspector, and proven it was ok when I painted them in different colors. I was induced to error by the debug window that has hidden my DebugLog tests only presenting ONE line instead of a list of them. If you follow and read with detail all the posts I made here you will understand what occurred.

[Previous page](https://forum.xojo.com/t/listbox-subclass-q/67040.md?page=1)
