Hi everyone. I’m just a “hobbiest” programmer learning Xojo. I have a problem that bewilders me and wondering if anyone has any thoughts.
I’m just delving into canvases and how to use them to create a more versatile “list” box (alternating colours etc). Now, I’ll try and explain as best I can - I have a tab control with about 5 tabs. On the first tab (0) I have several controls including a list box in the upper left quarter with several columns and rows etc). On the 4th tab (3) I then have a canvas control taking up the entire area. On this I am creating the list box I mentioned where multiple lines of info are displayed.
All is good EXCEPT, when I first open the app it starts on the first tab and then, when I first click on the 4th tab, with the canvas control, an outline of the list box from tab 0 is clearly seen drawn in the canvas. If I click away and come back, it is gone and all is as expected. I have tried and tried different things but cannot, for the life of me, figure out what is happening - does anyone have any thoughts? Is it something lacking in my understanding (probably!) or is there a Xojo bug of some sort I am unaware of.
Anyway, sorry this is so long and I hope it is detailed enough to explain the issue - any help, GREATLY appreciated.
uncheck the “usefocusring” property of the listbox on the first tab.
also you can have alternate colors in a listbox subclass by writing, in the CellBackgroundPaint event of the listbox :
if mHasAlternateRowBackColor then
if row mod 2 = 0 then
g.FillRect 0,0,g.Width, g.Height
assuming mHasAlternateRowBackColor is a boolean property of the listbox.
Jean-Yves, Thank you so much for that! It’s done the trick
Thanks also for the other tip re the alternating colours, I actually did already know that one. What I need tho, is a way to have the actual text in different colours, so if anyone knows how to achieve that I would like to know, but my understanding is it can’t be done with Xojo’s list boxes.
Thanks everyone, I’ll look into these.
Markus, it may have been a misunderstanding from me, but I was reading an article from xDev magazine a few months ago about how to use list boxes from Cocoa with the main reason, I thought, that xojo’s was very limited. But, I’ll definitely look into it again.