window opens blank, controls don't refresh

A window of type Sheet has the following controls on it:

1 Label
1 PopupMenu
1 TextArea
1 Canvas
3 Buttons

This window gets opened via menu item from the main window.

Only on Windows (64-bit), when I open this window, it appears blank, except for the canvas, which has its Backdrop property set to show a .png If I drag the window from the titlebar, then all the controls appear.

Selecting an option in the PopupMenu is supposed to change text in the TextArea and change the Canvas backdrop. Only the canvas changes. The TextArea doesn’t update. If I click and drag the mouse over the TextArea and select the text, then it changes.

Calling .Invalidate .Refresh .Update .UpdateNow, etc. doesn’t do anything.

On Mac, none of this nonsense happens, everything works as expected.

Any ideas what’s causing this and how to fix it?

Thanks.

P.S. I tried changing the window type to Document and it didn’t make any difference.

What version of Xojo are you using?

Is this an old or a new project?

Has it worked before or is this your first test on Windows?

Does your project have any SendMessage declares in it?

2018r2

New.

First test.

No.

The project was made on my Mac, then ported over to the Windows IDE for tweaking. I’ve worked this way for over a decade and have never seen this problem before.

The Sheet window gets shown using ShowWithin( parentWindow ) on Mac. Normally I don’t have to change that in Windows builds even though Sheet and ShowWithin don’t exist as such on Windows. I tried changing it to Show instead of ShowWithin thinking maybe this would change something, but it changed nothing.

I thought maybe somehow the controls had lost their parent properties (somehow they don’t belong to the window?), so I selected all the controls and nudged them around a few pixels and back in the editor. No change.

Are you able to share the project or if not a simple example of it happening?

Here’s something … I did this:

  1. Selected all the controls and chose Edit > Duplicate
  2. Deleted the original controls.
  3. Moved all the new controls into place, and got rid of the 1 at the end of the names, so they have the same names as the originals.

This almost fixes it. Now all the controls except the 3 buttons show. The TextArea also updates correctly. Seems to be some kind of corrupted objects problem.

Sorry I can’t really share the project, can’t duplicate the problem in a test app either.

Here is something that also might be a clue. I use Sheet windows a lot in my apps, so in my project template I have a window called NewSheetWindow that I duplicate, rename, and customise whenever I need a sheet window. The NewSheetWindow has 3 buttons on it, nothing else. These 3 buttons are the only thing still not rendering when the window opens. Duplicating the controls fixed the problem for the other controls, but not these 3 buttons.

Do you have any code inside any Paint events in any of the controls or windows?

Hm, oops yes, the .Background property is set in the paint event of the Canvas. That should not be there, should be in the method called from the PopupMenu.Change event …

And guess what. Moving that code fixed it!

Thanks! :slight_smile:

Nice :slight_smile:

Yes, a bit bizarre, but there it is. Mr. , you ask good questions! I’d still be fumbling around without your help. Next time I’m in the UK, you get a free pint :slight_smile: