Actual carbon widget visibility and tcontrol.showing value can become out of sync
Original Reporter info from Mantis: djenkins @dfjenkins
-
Reporter name: David Jenkins
Original Reporter info from Mantis: djenkins @dfjenkins
- Reporter name: David Jenkins
Description:
Using LCLOBject.Visible in the HIViewSetVisible() call of TCarbonControl.AddToWidget allows the carbon object and the TWinControl object to possibly become out of sync on whether object is showing or not.
Control.FShowing, set in TWinControl.UpdateShowing can only be updated if FShowing and TWinControl.HandleObjectShouldBeVisible are not equal. HandleObjectShouldBeVisible is based off of TWinControl.Visible and TWinControl.Parent.Visible. So changes in FShowing won't happen until the Parent.Visible changes too.
However, in TCarbonControl.AddToWidget, HIViewSetVisible is called with LCLOBject.Visible only. Which means that the actual object will follow TWinControl.Visible and not TwinControl.Visible and TWinControl.Parent.Visible.
This shows up when we load a control with Visible := True and then try and set it False later. In CreateWnd, FShowing is set false no matter what but then when AddControl is called TCarbonControl.AddToWidget calls HiSetViewVisible with Visible = True which makes the control show. The LCL side (TWinControl) is never alerted to this and leaves fshowing false. Which means when we change Visible from True to False, FShowing and Bshow in UpdateShowing are already equal and we exit out of UpdateShowing without calling ShowHide to change the widget state from showing to not showing.
Suggested fix is to call LCLObject.HandleObjectShouldBeVisible in TCarbonControl.AddToWidget HIViewSetVisible call instead of LCLOBject.Visible.
Patch against rev 36681 attached
Mantis conversion info:
- Mantis ID: 21731
- Version: 0.9.30.5 (SVN)
- Fixed in revision: 36766 (#435b2238)
- Monitored by: » @dfjenkins (David Jenkins)