CheckBox display problem

Started by ScottBolton, January 13, 2016, 05:22:01 AM

Previous topic - Next topic

ScottBolton

I have a form with two buttons and a checkbox in a rectangle. The checkbox is above the rectangle in order. I click button1 and the rectangle and checkbox are made invisible; I click button2 and the rectangle and checkbox are made visible again, only the checkbox is not visible unless I move my mouse over it. Anyone know why?

Code (autolisp) Select
(defun c:bTframes/Form1/Button1#OnClicked ( / )
  (dcl-Control-SetVisible bTframes/Form1/Rectangle1 nil)
  (dcl-Control-SetVisible bTframes/Form1/CheckBox1 nil)
  )
(defun c:bTframes/Form1/Button2#OnClicked ( / )
  (dcl-Control-SetVisible bTframes/Form1/Rectangle1 T)
  (dcl-Control-SetVisible bTframes/Form1/CheckBox1 T)
  )



owenwengerd

Tab/Z order does not affect the graphics Z order, at least not reliably. In Windows, the only way to guarantee that one control is painted on top of another is to make the top control transparent. This is because Windows always paints non-transparent child controls before transparent child controls. Therefore, if you make the checkbox transparent (background color = -24), it should always be painted on top of the non-transparent rectangle.

I hope that helps.
Owen Wengerd (Outside The Box) / ManuSoft

ScottBolton

Thanks, Owen, for your reply.

Just checked and the rectangle is already -24.

My form is actually more complex than the example I showed and all other controls - OptionButtons, OptionLists, Labels and TextBoxes - display correctly.

I made the rectangle a TextBox and the buttons behaved as expected so there appears to be a glitch in the relationship between the Rectangle and the Checkbox.

owenwengerd

Quote from: ScottBolton on January 14, 2016, 12:45:31 AM
Just checked and the rectangle is already -24.

It sounds like you think it should be -24. If so, you misunderstood what I said in the previous message. If you want the rectangle "behind" another control, then it must not be -24.
Owen Wengerd (Outside The Box) / ManuSoft

ScottBolton

Owen, I did misunderstand you. Apologies.

I changed the background of the rectangle to not transparent and the GUI displayed correctly. However, in Studio the checkbox is covered by the rectangle despite the order being correct. So I think I'll leave everything transparent until the form is complete then change any rectangle that is underneath a checkbox.

owenwengerd

No problem, I'm glad you got it sorted. In Studio things are more complicated because the OpenDCL control windows are represented by a container window that has the control window embedded as a child, and so the OpenDCL control windows are cousins instead of siblings like they are at runtime.
Owen Wengerd (Outside The Box) / ManuSoft