In previous versions of OpenInsight the position of a Window or control has always been determined by its SIZE property – an @fm-delimited array comprised of the Left, Top, Width and Height values. This means, of course, that all of these values have to be processed together at the same time.
For example, if you only want to update a control’s Top attribute then you first have to get the current SIZE property, update the second field, and then set the entire array again like so:
ctrlSize = get_Property( ctrlID, "SIZE" ) ctrlSize<2> = 100 call set_Property_Only( ctrlID, "SIZE", ctrlSize )
This can become tedious to write and it is also inefficient.
For version 10 we’ve exposed each of the SIZE fields as separate properties so you can now access them directly. The new properties are:
Here’s the previous example updated to use the TOP property:
call set_Property_Only( ctrlID, "TOP", 100 )
Positioning using rectangle (RECT) coordinates
Those of you used to working with the Windows API will know that many API functions don’t use Width and Height values when dealing with positioning: they work with a “RECT” structure that uses Left, Top, Right and Bottom values to define an object’s position instead (i.e. the coordinates of the top-left corner and the bottom-right corner).
In some cases being able to update a position using Right and Bottom instead of Width and Height can actually be more efficient because it can mean less calculations needed in your own code, and so a new RECT property has been added to enable this functionality.
The new RECT property works in exactly the same way as the current SIZE property except that the Width and Height fields have been replaced by the Right and Bottom fields like so:
* // RECT property structure * // * // <1> Left * // <2> Top * // <3> Right * // <4> Bottom
As with the SIZE property we’ve also exposed the individual fields as separate properties so there are two new properties to complement RECT which are:
SIZE, RECT and “stealth mode”
As you may know, when using the SIZE property with the Set_Property function you can set a “visible” attribute in the 5th field that can control the visibility of the object when it is moved. For example, setting the SIZE of an invisible WINDOW makes it visible by default unless you set this visible flag to “-1”. This is still the case in version 10 and it also applies to the new RECT property as well.
However, we have also added a new 6th field that can contain a “Suppress Change Notification” flag. When this flag is set to TRUE$ the object that has been moved receives no internal notification from Windows that it has been updated, so this will stop any MOVE and SIZE events from begin raised as well as preventing any autosize processing. This is sometimes necessary when you have complex positioning requirements.
* // Full SIZE property structure when used with Set_Property * // * // <1> Left * // <2> Top * // <3> Width * // <4> Height * // <5> Visibility * // <6> Suppress Change Notification
* // Full RECT property structure when used with Set_Property * // * // <1> Left * // <2> Top * // <3> Right * // <4> Bottom * // <5> Visibility * // <6> Suppress Change Notification
(Disclaimer: This article is based on preliminary information and may be subject to change in the final release version of OpenInsight 10).