Listbox: Color flag in a Column


I wanted to add a user feedback depending on a date in each row; I already that using html, but since my lists will now be created / displayed using a dedicated application (Easy Displayer), I decided to use a colored circle (I just took the OSX window dots; I will modify the colors to meet my needs later.

Here’s what this looks alike

(The image link is: (in case the image above is not displayed; I do not see it now).

The idea is to flag with a yellow (or a blue) every Monday Rows and using a green every Sunday (if the displayed week will shows 7 days).

I think the Red dot will be applied to wrong Date(s), but this have to be thinking later.

Note: this is a simple demo, something to prove the idea can be implemented. The real code to check the date in Column(1) and display the colored dot in Column(2) have to be implemented.

Do you like that ? You can place your comment(s), advices, suggestions, etc. TIA.

Here is the used code to build the screen shot.

I placed the code in CellTextPaint:

[code] #If DebugBuild
If Row = 0 Then
If Column = 2 Then
Me.CellAlignmentOffset(0, 2) = 16
g.DrawPicture Bulle_Green_Sunday,0,(Me.RowHeight-10)/2
End If
End If

If Row = 1 Then
  If Column = 2 Then
    Me.CellAlignmentOffset(1, 2) = 16
    g.DrawPicture Bulle_Yellow_Monday,0,(Me.RowHeight-10)/2
  End If
End If

If Row = 2 Then
  If Column = 2 Then
    Me.CellAlignmentOffset(2, 2) = 16
    g.DrawPicture Bulle_Red_Error,0,(Me.RowHeight-10)/2
  End If
End If


There are dozens of posts about how to color a cell based on the cell contents.
This is the same question but using an image.

What are you asking?

The colors do not suggest days of the week to me.
Is the day of the week useful or important to people looking at the list?

Your opinion ?

Circle, square, polygon ?

I do not know, it can be, without asking, how can we know ?

@Emile: please ask questions related to Xojo. Like code xyz doesn’t work. What did I do wrong? Or: what is the best architecture to handle abc? We can’t design your app for you.

What do you use the weekdays for? Date of a new comic? Why wouldn’t the name of the weekday work? Color coding IMO only works for a maximum of 3 colors. Say red, green and red. Everything else leads to massively ugly Excel spreadsheets in all colors known to mankind where more work is spent with the color coding than the data.

That is mainly for daily comic strips, 313 or 314 daily strips a year.
In a list of entries for 10, 50 or more years where days of the week (usually no Sunday is displayed), if you need to know where are Mondays (for example) because the list is created automatically from text file names, having a blue flag for Mondays is a good thing to show.

That is my example and I ended to add that because in a 313 (or so) list of entries for a year, I was tired to count the days to know if all days (except Sunday) are present.

I already do that in html before I create this Xojo project, and the list in either Firefox and Safari were nice, but the construction process was time consuming (doing most of that by hand.

That is not what I asked. I find the screen nice (watch the screen shot) and I wanted to share that. Any positive comment is welcome.

There are tons of use of this project, I mostly use it for comic lists, but I also have movies list, music lists, politician data, and so on. This is just a matter of available data. I have plenty data in my hobby which is… Comics (between others).

Thank you for your answer.

BTW: I do not explain why I use a graphic flag instead of a text flag. This is just a matter of not saving the text flag with the data / exclude the text flag when Copy / Cut, etc. I had that in mind before thinking at the design of the flag (form, color). And because it was a proof of concept, I took the three little dots from OSX (to waste less time).

If it is important then I would use a Highlight popup with choices to highlight Monday, Tuesday, etc

Maybe even a custom popup menu with checkboxes for the different days to select more than one.

And I would properly align the text even if no highlight is applied - as it is it looks somewhat ugly.

I have never seen days of the week coded as colors. Guess there is a time for everything.

Not discounting the color, why not add a two letters information inside the dot to make it clearer ?
Su Mo Tu We Th Fr Sa
Lu Ma Me Je Ve Sa

Thank you for your answers.

You’re right. I do not saw that one… (not enough or too many entries with a dot ?).

My original idea was to flag all days that are Monday (only), automatically. Are you thinking “let the user flag the day he want to flag?"
That’s an idea.

I can add a specific Properties window (I already have some).

Row height (the default value) is low, the “dot” is 14 pixels Ø, so adding a letter is a good idea (thanks), but I am unsure if it will makes a difference (on the other way, I love the idea: every row have its day of the week tag…)

I have ideas (work) on my plate to think about.

[quote=280098:@Michel Bujardet]
Lu Ma Me Je Ve Sa[/quote]
I think you missed a day in French. (Dimanche?)

[quote=280120:@Paul Sondervan]I think you missed a day in French. (Dimanche?)

Yes, you are right :wink:

Use text size 8 or 9, and this will work. As compared, the standard Apple icon badge diameter is 16.

Michel (Thanks):
I say nothing for the missing Dimanche because I understoud the idea.

Also, the size of the text in the circle: 'till I do it, I will not complain (excepted if my poor old eye cannot read it (Nota: I use a magnifying glass to read text, sometimes, so…).

While eating, I was thinking at drawing the flag (black frame, colored inside and black text), and asked myself “what about putting it right aligned in the column ?”
Because I do not know where to get simply that Column Width as my answer… then I recall the Window in List mode in OSX Finder: I have troubles with tags… to know where the Tag is (on which Row own this Tag…) but the Row display is different, so…
Someone knows how to get a Column width when the code runs in ListBox.CellTextPaint ?

And, if I stay with the circles at left, it will be easize to set a ColumAlignmentOffset than setting CellAlignmentOffset for each (?) Row.

Remember: I do not have yet set code excepted the one I shared above. So, I have many things to think at.

I agree with Beatrix, 7 colors (one for each day of the week) is too many. Go with Markus’ suggestion and allow the user to select a day of week to highlight. You wouldn’t necessarily need to use a flag then, just change the color of the text.

Column width at runtime is found in Listbox.ColumnWidthActual.

Thanks for your kind answer Tim.

I love your suggestion: far less code, elegant and easy to watch.

Listbox.ColumnWidthActual: ??? I think I didn’t saw that entry. I’m going to read it.

ENF: Entry Not Found (2015r1 / 2016r2).

Go figure: I already use 4 background colors (One for Odd, One for Even, One to say this is a special Intro Row and the last, Pink, that says: missing entry). Green background Rows appears every 42 / 48 / … 96… Rows so it is not disturbing IMHO. The Pink (Missing) Background is disturbing, but only when there are many Rows at once [crying because it means missing data :)]

Sorry, it’s Listbox.Column().WidthActual.

Listbox.Column().WidthActual: if I ever read it (added more than 4 years ago), I fast forgot it, and in Xojo help: I do not saw it too.

ListBox.Column: the name does not appeal me when I saw it.

my fault: I do not found it; but I searched for it !

Grazie mille