Wiki Home

ZOrder Set

Namespace: VFP

This is a really obscure command. You'll notice that when you type it in the command window, the line turns blue and stays blue.

However, it doesn't do anything in the command window -- it only lives in the Properties memo field in the VCX file. In this way the command is similar to the Do Create = .T. found in the Properties field within the first record of any form base class.

So what does it do? It gets in your way, that's what it does! If you've ever had trouble setting the Tab Order for controls within a form or container? Have you ever used the Tab Order to set everything perfectly, only to lose this new order the next time you open your container? Have you ever copied controls from one class to another and get a crazy tab order set for the new controls? You've been bitten by the ZOrder Set bug.

I've known about this problem for years, but I've never been able to duplicate a condition that places a ZOrder Set within the Properties memo field within my class. If you can, please let me or MSFT know, since it is definitely a bug.

The symptoms have been described above. Most everybody has experienced this at one time or another. If you currently have this condition (the Tab Order resets out from under your feet) and you're not doing crazy things like firing various ZOrder methods and setting/resetting tab orders on the fly, you need to open up your VCX as a .DBF, find the appropriate class, and strip out all the ZOrder Set references in the Properties memo field. Close the table and reopen the class. *Now* you can reset the Tab Order correctly.

Note: CodeBook, Visual FoxExpress and I assume the Mere Mortals frameworks are littered with ZOrder Set commands. The Fox Foundation Classes has 'em as well.

Folks, we should remove all references to ZOrder Set in your VCX classes! Treat 'em just like cockroaches...

As noted before, I don't know how to reliably recreate a ZOrder Set in the VCX, but it's obviously tied to interactively setting a Tab Order. I recommend that if you're modifying a class, do *not* use the Tab Order menu bar off the View menu pad. Instead, I do the following: Grab the controls that are out of order with the mouse (hold the Shift Key and click on the controls in question), Ctrl + C to copy (just in case), then Ctrl + X to cut and Ctrl + V to paste. Your controls are misaligned, but don't panic -- just hit your left arrow key 8 times and hit your up arrow key 8 times. You're realigned as before.

Now click off the next item in the tab order. Repeat the Ctrl C,X and V keystrokes, removing a control each time until there are no controls left. Now save the class.

This process, while involved, assures that the records are placed in the correct order within the VCX. You get used to it pretty quickly -- it's not really a problem. This is what ZOrder Set attempts to solve -- setting the tab order differently than the order of the records in the .VCX. That it does correctly, but it *definitely* causes more problems than it solves.

Note: Be sure to strip out *all* references to ZOrder Set before starting this process!!

*** Additional Information - contributed by Larry Bradley 1999.10.01
As far as I can tell by experimentation, ZOrder Set appears in the properties field when you use "Send to Back" and "Send to Front" on an object. Setting the TAB order does NOT appear to change ZOrder Set.

When I used the "Send to Front" and "Send to Back", then saved the class, two things happend: the order of the records in the VCX changed, and the ZOrder Set property was also set. The object that was "Sent to Back" had ZOrder Set = 0, and was also was closer to the front of the VCX than the others. The record order and the ZOrder Set order were the same.

I gather that this is used to control the order in which objects are instantiated - VFP starts from the top of the VCX. If the physical order and the ZOrder Set order are the same all is well. But if they don't match, problems seem to arise.

Note that if an object "A" contains other objects "B" and "C", (i.e. "A" was defined as a class, and the class definition included objects "B" and "C"), then there will NOT be any records in the VCX for objects "B" or "C". Instead, the properties field of object "A" will set various properties of objects "B" and "C" - specifically, the ZOrder Set for them.

I has a case in which the objects "B" and "C" came up in the WRONG order, no matter how I used "Send to ..." I had to edit the VCX, and remove the ZOrderSets for these objects in the properties field of object "A". THEN I could set them properly.

See also: Tab Ordering
Contributors: Bill Anderson
Category Undocumented VFP Functions Category VFP Troubleshooting
( Topic last updated: 1999.11.26 02:28:35 PM )