Text Field Showing Through Listbox

Hi,

I have an app that has listboxes used as a drop down from a text field. You click on the text field and the listbox appears. Everything works okay under Mac, but under Windows when I move the mouse down through the list boxes selections, the Text Field underneath pops through. and blocks the listbox. I have the listbox arranged all the way forward, but the text fields still show through.

Here is a picture:

What the heck is going on. Am I missing something? The listbox should stay on top of the text fields. Any suggestions would be appreciated.

Thanks

Jim

What About Z-order?.. Try copying the list box, delete the original and then past the copy so that it will be at the top of the Z -Order.

If that does not work try putting the LB in a container control and put that on the window last.

[quote=139380:@Karen Atkocius]What About Z-order?.. Try bringing It to the top.

You can change the place of a control over others with the order controls on top of the central pane of the IDE, 5th series of icons from the left.

As I said above, I already have the listbox all the way forward, so that does not help. It works under Mac OS X fine, but Windows the text field shows through.

The container control will not work either since some of the Listboxes are in a container already and also are covered by a text field. I don’t think I can put a container inside another container.

It should not perform that way. If you move a control in front of another it should stay in front. The control below should not show through. I guess it is another bug on the Windows builds. Very frustrating. Now I will have to hide the text fields when the listbox shows and then show them again when the listbox goes away. It adds more unnecessary code and looks bogus.

One more possibility… out the listbox in a plain box window and put that in the right place There are more details to work out but I think they are soluble.

  • karen

You can put as many containers inside other containers as you want, but that does not solve the issue. I tried placing the listbox inside a container but still the textfields pop up.

It seems the textfields claim their place through everything.

It is definitely a Xojo bug, not a Windows bug. I filed a report :
36238 - TextField pops over through a listbox when mouse hovers
<https://xojo.com/issue/36238>

The best solution I can think of is in MouseEnter to set the width of the left textfield so it does not go over the listbox left, and to change the left and width of the right hand side textfield so it does not go over the listbox. Then in MouseExit restore the place and dimension of the TextFields. I tested it, it works convincingly.

OK. Found and tested the solution. It is so simple : place a canvas between the textfields and your listbox. That will prevent the mouse from changing the z order.

Just use the same code you use to show the ListBox to do that.

I do that a lot as well, but often it invites other issues related to flickering and incorrect drawing of controls (for example the group box caption loses its transparency when the control is put on a canvas control). In general the canvas is helpful in this spot, but it can invite other problems.

It tried Win32 SetWindowPos and it works while the mouse is over the listbox, but as soon as the cursor hovers the textfield, dang, it pops over the listbox. So canvas seems to be the only game in town.

I believe if the canvas is set exactly at the same size and over the textfield, it should minimize side effects. The ideal, of course, would be that the bug be fixed, but I doubt it will happen right away.

Anyway, the idea is to remove the canvas with the listbox, so it is not as if it was sitting there all the time.

I’ll try the canvas solution. It should work as long as it does not cause flicker. Thank you for your help. I appreciate it.

Could you subclass the Canvas to replace the TextField (i.e. make a “Canvas TextField”)?

Much simpler : use a TextArea. I tested, it does not have the same focus bug.