realbasic-nug
[Top] [All Lists]

Base window control for Composite views?

To: REALbasic Network Users Group <realbasic-nug at lists dot realsoftware dot com>
Subject: Base window control for Composite views?
From: James Milne <james dot milne at mac dot com>
Date: Mon, 1 Mar 2004 02:12:12 +0000
Hi Guys:

I think I've may have found what's going wrong with the backgrounds in my Composite
windows.

It looks as though both the Window.Backdrop property and the Window.Paint event are
broken for Composite windows, and here's why:

REALbasic really needs a base HIView control that is created for each composite window just below the top of the control hierarchy. This control should be the one that paints the window backdrop, or calls the Window paint event. This will ensure that the
background of the window will be drawn at the correct time.

At the moment, I've tried the following approaches (all assume I'm creating my own subclass of Window, and make it the super of all the windows in my project.)

1) Draw the background in the Window Paint event. This frequently breaks because there is no way to clip the paint operation to the dirty area, and when the paint event runs, it blits over the top of the other controls in the window, leaving only the control
you called Refresh upon visible.

2) Draw the background in the Window Paint event, but refresh the controls using a special function which adds the bounds of the control to a list of dirty regions in the control's parent window. When the background painting code runs, it notices it has a list of dirty regions, and clips the background painting to these regions. This frequently breaks because somehow, through composite mode drawing, the native Mac OS X background is drawn for the rest of the window and my custom background is only
drawn for the dirty regions.

3) Don't draw in the Window Paint event, and use the Backdrop property. This has the
same visual anomalies as method #1.

I'm guessing it is not the case just now that REALbasic creates a control inside the root control to use to draw the background of Composite windows. If this is not the case, I'll make a feature request and submit a project which demonstrates the differences in
approaches to redrawing the background.

The workaround it would seem, for drawing backgrounds, is to create a canvas subclass, and create an instance of it equal to the dimensions of the window, and place it at the back of the control order, so that all the controls in the window are children
of it. This canvas can then draw your background.

--
James Milne


- - -
Unsubscribe or switch delivery mode:
<http://support.realsoftware.com/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

<Prev in Thread] Current Thread [Next in Thread>
  • Base window control for Composite views?, James Milne <=