Something that's going to bother me

| | Comments (0)

I just noticed today that using a MessageDialog produces incorrect results on Windows. It gives you a dialog that has no close button!

So I went to fix it (it was easy enough to turn the close button on), and then I realized why it was turned off in the first place. Turning the close button on enables the system menu (WS_SYSMENU), which in turn places the application icon in the titlebar as well. However, that icon only appears for a dialog *if* an icon is set for the window class. If none is set and the frame type is dialog, then you get no icon. (Note, if the frame type is not dialog and no icon is set, you get the default Windows application icon instead). So if you look at the standard "would you like to save dialog", or even a MsgBox, you'll notice that there's no icon in the upper right of the window. However, if you use the MessageDialog class in REALbasic (including using MsgBox with the optional parameters), you will get the icon there.

This is because REALbasic only has one window class for any visible dialog (called RBWindow, in case you're wondering). And in order for the application icon to properly appear in document windows, we have to set the icon property on the class we register. So that means that when we make an RBWindow, it will always have an icon if it also has a close box.

The correct way to fix this (in the case of MessageDialog) would be to register another window class that has no icon set on it, and use that class when making the MessageDialog window. However, that's a royal PITA due to the way the code is setup, and a rather heavy-handed approach. So instead, I'm going to leave the close button off the MessageDialog window (since it's less obvious that it's missing compared to having the application icon show up when it's not wanted) until I get the chance to refactor our window creation code.

I hate running into UI issues where it's simply impossible to get the correct behavior and not be able to fix them immediately. But this one would take about a day to fix properly (not including testing time), and there just isn't enough griping about the MessageDialog class to warrant doing it when we're in crunch mode. So I've filed a bug report against it (feedback id: mmhcpxwz), and I'll fix it when I get the chance.

Leave a comment

Disclaimer

I'm currently an employee of REAL Software. My blog is mine. The opinions represented in this blog are mine as well and may not represent my employer's opinions. All original material is copyrighted and property of the author.

REALbasic® is a registered trademark of REAL Software, Inc. REAL SQL Server™ and Lingua™ are pending trademarks of REAL Software, Inc. All rights reserved.