Window background color is changing, but why?

Not much to go on here, but hopefully someone recognises this issue. My main window has a background colour set in properties. It has a label on it with this code:

SectionStories.Visible = true

SectionStories is a rectangle and becomes visible when clicking the label. But also, the background colour of this window is changing. Why is this?

A screenshot may help; especially because of the rectangle size and the two colors.

Basically, the eye may be fooling you depending on these.

Also, I use a Pink that is less visible on one screen than others… there are differences between what is in my M1 MacBook Pro and an Intel i5 (as I can see on screen)…

If you are on a Mac and the system has desktop tinting turned on then the background of a window can be affected by the current wallpaper. Check the following setting:

Rectangles are not affected by this.

But wallpaper tinting is not supported by Xojo out of the box.

That’s not quite true. Dialog windows are certainly affected by it, as are toolbars. Turned on:

Turned off:

In dark mode it is easier to see:

Ian:
from where your screen shot have been done (what application ?).

Also, look at the window below:

Here’s the code:

Function CellBackgroundPaint(g As Graphics, row As Integer, column As Integer) Handles CellBackgroundPaint as Boolean
  // 
  // Ajoute une couleur de fond à chaque ligne définie
  //
  If row Mod 2 = 0 Then
    g.ForeColor = CMY(0.5,0.0,0.0)
  Else
    g.ForeColor = CMY(0.0,0.0,0.5)
  End If
  
  If Row = 5 Then
    g.ForeColor = CMY(0.0,0.5,0.0)
  End If
  
  If Row = 8 Then
    g.ForeColor = CMY(0.0,0.5,0.0)
  End If
  
  g.FillRect(0, 0, g.Width, g.Height)
End Function

I added the two Pink lines for this demonstration.

As you can see in code and @ screen: the color is the same, but looks different depending on what is around (or is it my eyes ?)
Done on a MacBookPro m1 / Ventura.

So, some ■■■■■ things can happens. (and this is plain English, if a word is missing it is because this ÌÏŒÍÎË software removed it wrongly “thinking”… :rage:).

Mine are simple dialog boxes, with a group box placed on top of them containing most of the controls. The slight differences in the window background in my images is due to the wallpaper tinting feature of macOS. In this the wallpaper colour is used to tweak the background colour of the window.

Here is a trivial application I just put together. It has a Window with a single button “Show dialog” and another window set as a Modal Dialog, which also has a Close button. The only code opens the modal dialog and closes it from the second button. Nothing special. Here is how it looks with wallpaper tinting turned off:

and turned on:

You can see the two have slightly different window backgrounds, caused by wallpaper tinting. Drawing you do with graphics methods and setting colours will never match that background colour. The result will change depending upon the wallpaper image you have showing. Mine is on continuous rotation so varies over time.

The screenshot only shows a single document window, which is different based on tinting.

So after lots of trying out, I found a solution to the randomly background colour changing of the main window. It has to do with the parenting of the rectangles I use on the main window (and maybe this is the same with other objects). When the rectangle is not exactly placed in the corner of the main window even when the parenting from rectangle to Main Window is correct, the Main Window takes on the colour of the Xojo editing screen. I am not using that colour anywhere in my app and I only see it being used in Xojo, so I assume that is where the Main Window takes the colour from.

Now I know this I solve this issue by first cut and then past the rectangle and then drag it again on the Main Window, taking care that the parenting is happening correctly.

An annoying issue is that when I drag an object from the Main Window onto the editing area in Xojo, I cannot drag it around anymore after that. It stays stuck on the place where I dragged it. Only way around is to cut and paste it. Then it’s unstuck again.

Also, why is there a limit on the editing area in Xojo? I can only drag object to a limited distance from the Main Window, when I drag it further away it snaps back to the old position. I could use more editing space for all the objects I am using.

btw. When dragging something on the Main Window, the red outline appears around the Window to show the parenting happening, but what does it mean when there is a purple outline around the Main window?

I know this one off the top of my head… because the editor is drawn as a picture and the maximum size of a picture is 32000x32000, that’s the max size of the layout canvas. In general, you shouldn’t need that much space for doing a layout though and you might want to consider using containers.

I think you misunderstood the problem described.

Let’s say you have a DesktopWindow that is 600x400, you add a button to it but for design purposes you want ti outside the window (you are moving things around, you want the object created but not in the window area, etc), now try to move the button to Left -600, the IDE will set it to Left -512.

Now try to change the Top to -600, the IDE change the top to -512.

Now try to change the Left to 2000, the IDE changes that to 1544.

Now try to change the Top to 2000, the IDE changes that to 1404.

That is what André is talking about in “I can only drag object to a limited distance from the Main Window”

1 Like

Yes exactly. I hope this will be much larger in the future.

If there is no feature request and people wanting this, I don’t think it will change.

MacOS window have a limit (10,000)… Read there: NSWindow Max Size.

Also: remember all of this takes Memory. You may have plenty available, but what about your users ?

I am talking about the edit area in Xojo, this is not related to the window size of the app I am creating.

Sorry for the misunderstanding.

I’d really like to see auto-scroll when an object is dragged to the edge of the visible area, and the ability to zoom in and out (preferably with pinch gesture support).

2 Likes

But it’s still an important bug. Is that really us, the users, who should spot which bugs need to be fixed?

In this case I don’t see a bug.

Who could predict that a user wanted to put a control so far away from the designed window? I still don’t understand why is needed to put a control more than -512 pixels away from the Window.

I could imagine a text area with a size greater than 512. But, well, I get your point.

But it can be set at 2000 (at the right of the window) and Window1.Left is set to 1100…