Icons in DesktopListBox disappear when row is selected

Good afternoon (o;

Playing around with DesktopListBox and several events for painting to display own icons.

If I use the PaintCellBackground to draw an icon in front and one at the end and return false, it draws all fine.
But when I select a row it is marked blue, text is inverted, but the icons are gone.

If I return True, no selection can be seen at all…but icons stay.

I guess when returning false, the app itself handles the inversion of the text color.
But even if I don’t do any color inversion for the icons, it should still be visible as black icon on blue background.

Returning true or false from this event tells the framework whether or not you have drawn the cell yourself. As with any graphics context, later drawing is done on top of existing graphics, so you’ll have to draw the selection yourself if you need to return true.

Don’t use PaintCellBackground but CellTextPaint. But you need some string like " " or the cell won’t be drawn.

1 Like

So what is the benefit of PaintCellText then?

Hmm, indentation is bigger than with PaintCellText as it subtracts the row picture space:

Sadly expandable rows can only have one column…but anyway…getting more and more fun playing with it (o;

PaintCellBackground is for drawing your own selection. PaintCellText is for drawing the things that go on top of the selection, like text.

As I said, you certainly can draw the image in PaintCellBackground, you just need to check if the row is selected and draw the selection first.

But the graphics area for expandable rows is reduced for accounting a row picture, or the expand/collapse icon, as I understand it.

OTOH this leaves space to also show an expand/collapse in front of the row displaying the source file, so the used modules can be displayed inside the file, and if they are missing.

Thanks for the great hints :slight_smile:

I’ve been playing with DesktopListboxes quite a bit lately. Not seen any disappearing icons… how are you setting the icons? As the rows image? me.RowImageAt(me.LastAddedRowIndex) = citem.IconForFile(s) gives you the image on the left hand side next to the expandable row icon (see below)

You can use a class interface and implement CanDrawMyself if you want to get really into the nitty gritty of them drawing in a very specific way, headers too. Markus Winter goes into the implementation of them pretty decently on the other forum if you google “Xojo Best programming practises: the ListBox” it should come up as the first search :slight_smile:

Hmm…wasn’t aware of the RowImageAt method at all…just tried PaintCellBackground and PaintCellText to draw my icons…

Always thought what the RowPicture was referring to in the documentation (o;

As I need not only several icons per row, but also maybe a progress bar, RowImageAt doesn’t fit my need…

But thanks for making me aware of this :slight_smile:

So, you do not checked the Xojo documentation ?

Only checked that what I need :wink:

And as the name implies, it only supports one image…not several as I need (o;

How do you know what you’re going to need?

If you’re doing something with a DesktopListbox (or indeed any other contrrol), my advice for the first time you are so doing, is to read through the entire doc page for DesktopListbox. You may well not retain most of it, but you’ll retain enough so that next time you’re looking at DesktopListbox for some purpose, you’ll remember that there was something about something to do with that, and then go look for it.

2 Likes

You can have multiple columns in expandable rows by the way!

This is the syntax to indent it.
Listbox1.AddExpandableRowAt(1,"expanded",Listbox1.RowDepthAt(0) + 1)
The third parameter specifies it’s depth (0 being top level) You then have to fill the rest of the cells for that row after it is added.

You can adjust your column sizes too - the string to size them is a ratio if I recall correctly (I.e “70%,30%”)

1 Like

I know how it should look like as I use software of the same kind (EDA) which are not available for macOS.

I’m still learning, so bare with me (o;

a. Development search:
I searched this morning in another place/documentation and do not found what I was searching. At one point, I had to go back, then write on a sheet of paper what I was searching because the search was so long… I forgot what I was seaching. I never found. I asked and some gentle person gaves me the answer (it was not where I was searching !).
The joy of internet.

b. real life search:
I needed to contact an old employer (Apple France), and never found an eMail for the Human Resources (HR). But I found the Company slow mail address.

1 Like

Okay…maybe some background here (o;

My intention is to develop a Xojo application for macOS for FPGA development (programmable logic).

Currently they are only available for Windows and Linux, mainly Altera Quartus (now Integrated Electronics, or Intel ;o), Xilinx Vivado (now AMD) and Lattice Diamond.

Now with more and more open source software like yosys, nextpnr and open FPGALoader available, it allows FPGA development for macOS, just not with a nice GUI as those mentioned above.

So I’m still experimenting with Xojo and its capabilities, and so far I am very satisfied with it (o;

Sounds really cool! And is looking pretty styled already.

Xojo’s really nice to use once you’re more comfortable with it, just takes a little bit of time and patience to get there (it’s not without its quirks tho!)

I can’t tell you how many times I’ve missed some random little line on the documentation and sent months (or even years at this point) doing something a certain way when there was some magic method that would have just one lined it…

Just got to trust the process! :slight_smile:

1 Like

Well I tried first with XCode…also for another project I did lately with Xojo (the pipe writer project ;o), but switched to Xojo for its simplicity and to get a fast show case.

Honestly, I didn’t use Xojo for over two years now…so takes some time to get back into it. But tomorrow starts the big discount day to get a new license (why do they always do discount before monthly salaries are being paid out? So I can only afford the Lite version ;o).

But the huge advantage I discovered these past days: The community here responds very fast with really great help, pointers and hints…try that on Apple’s Swift forum :wink: