One of the controls missing from the CF is the multi-select listbox. I started playing around with creating a custom control, but there are some difficulties with that. For one thing, when you inherit from listbox, you get a stub of a function, but there is no good documentation about what that function does, or what you are to do with the function. I have my suspicions, but never actually got around to testing them.

Instead, it occured to me that I could arrange a set of controls to act like a multi-select listbox, and have done so in two fashions. In general, I add a panel with a vertical scroll bar on it's right edge. On that base panel, I put a series of narrow panels completely covered by labels. A label won't receive a click, and has no backcolor property under the CF, but a panel does both. By positioning a label on top of a panel, the label appears to receive mouseclicks, and appears to have a backcolor.

The rest of the control consists of having a class that contains an array of objects. The objects have a name and a selected state (and several other things that aren't important here). When the scroll bar is moved, a sub is called that fills the labels with the names returned from the container class. Tapping an item causes the item panel to change it's color from white to blue, and the label to change it's text from black to white. Tapping again switches it back. This looks and feels exactly like a listbox with a multiselect capability.

The other form of this pseudo-multiselect control just used labels. The base panel has one color, and the labels toggle between black and some other high contrast color when pressed. Otherwise it works the same.

The first time I created one of these, it worked great. The vertical scroll bar was on top of all the item panels. However, I created another one of these, and the vertical scroll bar ended up under all the panels, which made it unuseable. In that case, since I had plenty of room, I fixed the problem by making the base panel wider than the item panels, and putting the scroll bar outside of the item panels, but I don't see what the difference is.

There doesn't seem to be a z-order accessible in the CF. Why would the scroll bar be on top of the panels in one instance, and under the panels in the second instance. I can't think of anything that I did differently? In the third instance, where I only used labels, the scroll bar sits on top of the labels without any problem.

Can anybody tell me what the difference is?