Events:
Programming for two platforms can be a tricky job. Specially when you can't find documentation explaining the differences. In this article I try to create a compendium of those things that you may need to watch when programming for windows and mac. I also invite others to help by sending your suggestions.
1. Events of a window:
Under Windows when the window is opened a series of additional events are fired. After the activate event the window will received a resized event, followed by a moved event.
If you are a VB programmer you will notice that the controls are created before the window open event is called.
In MacOS the MouseExit event is called right when the mouse moves to the titlebar and not so in Windows where the event is raised when the mouse is outside the visible region of the window. The MouseEnter is fired when the mouse is over the content area pass the title bar. This is pretty much the same in both platforms yet in Windows the MouseEnter is raised pass the menu if one is present.
GotFocus and LostFocus behave different. In MacOS GotFocus and LostFocus is only implemented in a few controls. Do not use these events as part of your
critical functionality. If you use these events in Windows notice that the window's Deactivate event will be fired before the control with the focus gets its LostFocus event. Also when the window is activated the control that had the focus will get a GotFocus event before the window's Activate event is raised.
Lets see the Minimize and restore events. These to are quite odd. First you get the Minimize event as expected, but then in Windows you will get a Moved event, followed by a Deactivate event and finally a MouseExit. In Mac all you get is the Minimize event. When you restore the window by clicking the Dock or the taskbar things are quite different for some reason. In Mac you get an Activate event followed by a Restore. In Windows you get a Restore, then a Moved, then a Resized, and then you get the Activate. If you are a VB programmer notice that when you minimize a window you will not get a resized event.
When you maximize a window you get the Maximize event followed by a Moved and a Resized event. Using RB 5.5.2 the events Moved and Resized are raised twice in the MacOS build. That must be a bug!
To be continued...
.
|