TWin7: textarea text colour problem

I have an app which I’ve been developing for a while under macOS. There is a textfield which acts as a status display - various parts of the app write a status message there, in red, green, or black. This works as expected. At the minute, I’m using Xojo 2017r2.1 under Mavericks.

Trying this in a VirtualBox VM under Win7, same Xojo version. Text is displayed in the textfield with the expected content, but it’s always black, and I’ve stepped through the method that writes out the text line, and it does set the colour, thus:

[code]ptr = MainWindow.LoggingTabs1.StatusBar

ptr.TextFont = “Verdana”
ptr.TextUnit = FontUnits.Pixel
ptr.TextSize = 12.0
ptr.Bold = True
ptr.Alignment = if (align=“middle”, TextArea.AlignCenter, TextArea.AlignLeft)

Select case colour
case “red”
ptr.TextColor = &cff0000 // Execution definitely passes here, …
case “green”
ptr.TextColor = &c008800
ptr.TextColor = &c000000
end Select

Dim d As Xojo.Core.Date = Xojo.Core.Date.Now
timestr = format (d.hour, “\ \ 0#\:”) + format (d.minute, "0#\ ")
ptr.Text = timestr.ToText + statusLine // … but the text comes out black.


Is there some reason for this not working? Elsewhere, I use a label to perform a similar function and coloured text works there under Win7 so I could probably switch to using a label if necessary.

check your “Color” variable… your default is BLACK, so if Color (uh Colour) is not “RED” or “GREEN” then you will get black

and perhaps try moving the last 3 lines towards the top, and set the color AFTER you set the text

Well as I said this works fine under macOS so you’re implying there may be a difference between how the IDE generates code between the macOS and Windows versions.

In any case, as noted in the two comments in the code in my OP above, I used the debugger to verify that the expected case was being executed.

I tried moving the code up as you suggest but to no avail.

Thanks, though :slight_smile:


This was reported years ago (2009 <>) but was “closed by design”.
I solve this by placing a rectangle, a few pixels larger, behind the textarea. This is far from ideal but at least it gives a colored frame around the textarea.

Thanks. I turned off readonly for this textarea and then the text appeared coloured as expected. I’ll see about getting the documentation updated.

I should have added that I prevent the user from typing into this field by using the GotFocus event to clear the focus.