Positioning 3d-objects in GEM -Joakim Högberg
Adjusting objects with 3d-flag set is a mess if you want it to show up properly when viewed under any AES out there. I have been struggling with this for a long time and thought I might share my discoveries with you.
1) FORM_CENTER method
This command will center an object in a tree and return x,y,b,h for its outer coordinates including any outer border, including the border that is added by setting 3d-flag. Sadly this solution does NOT work with N.AES. (Checked with 1.2)
I have come to understand that this method has been frequently used earlier, despite the fact that it is quite clumpsy to use. You will have to reposition the "measured" object before returning to the main code. Time to ditch this one I think..
2) OBJC_SYSVAR method
If AES>=3.4 then you can use this call to check how wide the horisontal and vertical additional 3d-border is. Under MagiC the 3d-flag will NEVER result in an increased border OUTSIDE the object, so if you detect the cookie "MagX" you will know for sure that the border width never is increased by setting 3d-flag. This might seem like a nice approach but the truth is that it breaks the GEM-standards, which of course not is a good thing. I do not say this is the best method around but it is the only one I have got to work, but this is how I did it:
3) MagiC specific problems
- Look for MagX-cookie
If the cookie is found both horizontal and vertical 3d-border are zero (MagiC is not sticking to GEM-standards!)
- Else check AES version
If AES<3.4 both horizontal and vertical 3d-border are zero
- Else call OBJC_SYSVAR
Values of horizontal and vertical 3d-border are returned
By this approach you do the messy stuff in the init-section of your program and later on just "know" the additional border width. Once you have implemented this code you have a way to properly (I hope!) position object. And, best of all, it works on everything from old single-TOS to Geneva, N.AES, MagiC.
If you wish to do everything by the book you should probably call appl_getinfo() to see if OBJC_SYSVAR is supported by the AES you are using, but I haven't bothered to do this and have not yet run into problems. ;)
If you are programming an application and want to have full control of the looks of it even under MagiC, you might want to know whether or not MagiC currently is set to view objects in 3d-style. Why? Well one reason is that MagiC will not have a black border surrounding the object and thus it might not blend in the way you expect. To find out if 3d-effects are enabled you can use this call:
Back to GFA-page