View previous topic :: View next topic |
Author |
Message |
rhosking
Joined: 21 Aug 2006 Posts: 14 Location: UK
|
Posted: Wed Sep 27, 2006 4:38 am Post subject: Possible layout bug in the latest snapshot (20060926)? |
|
|
I have downloaded and installed the latest snapshot (20060926) but is is behaving strangly with my application compared to the previous snapshot I was using (June - 20060624).
I have traced this down to the following code change in the onLayout method in control.d (Line 5429)
Code: | if(!ctrl.visible)
{
if(DockStyle.FILL == ctrl.dock)
ctrl.bounds = area; // Due to TabPage`s.
continue;
} |
I am laying out a component which is hidden initially. This is now failing. If I comment out the above code it all works correctly. Looking at the above, the 'continue' statement always executes if the control is not visible... is this correct? At the moment I have changed the code so that the continue statement is only called as part of the if statement...
Code: | if(!ctrl.visible)
{
if(DockStyle.FILL == ctrl.dock) {
ctrl.bounds = area; // Due to TabPage`s.
continue;
}
} |
Then everything works as before. |
|
Back to top |
|
|
Chris Miller
Joined: 27 Mar 2004 Posts: 514 Location: The Internet
|
Posted: Wed Sep 27, 2006 2:26 pm Post subject: Re: Possible layout bug in the latest snapshot (20060926)? |
|
|
The idea was that controls shouldn't affect the layout if they're hidden; this also saves some cycles. TabPage`s work a bit differently and needed some special treatment, and DockStyle.FILL doesn't affect the layout of other visible controls so it is safe to layout DockStyle.FILL even if invisible.
When a control becomes visible its layout should then kick in and position; is the problem you're having that this isn't happening? If so, it is a real bug; but if it's just preventing controls from layout positioning while they're hidden, it's intended.
I hope this makes sense |
|
Back to top |
|
|
rhosking
Joined: 21 Aug 2006 Posts: 14 Location: UK
|
Posted: Wed Sep 27, 2006 2:34 pm Post subject: |
|
|
Thanks, now I know a bit more about the new behaviour I should be able to fix my code to layout correctly.
The bug is most certainly on my part as I am coding a special custom control and doing slightly weird things! |
|
Back to top |
|
|
rhosking
Joined: 21 Aug 2006 Posts: 14 Location: UK
|
Posted: Thu Sep 28, 2006 7:56 am Post subject: |
|
|
I still have not been able to get to the bottom of this.
I am building a collection of controls on a panel before assigning the panel's parent property. This is a requirement of the component I am building. Could the late assignment of the parent property cause problems?
More weirdly(!), I am also subclassing the richtextcontrol to add support for capturing EN_REQUESTRESIZE notification messages as the user types. These sizing messages update the parent's height (what I am doing here is resizing the height of the richtextcontrol and it's parent as the user types - weird I know!).
I think a certain amount of layout looping is happening after the recent change to control.d.
I maybe able to solve it using the delayInvoke function, but I'm not sure how this works. |
|
Back to top |
|
|
rhosking
Joined: 21 Aug 2006 Posts: 14 Location: UK
|
Posted: Thu Sep 28, 2006 12:52 pm Post subject: |
|
|
Using delayInvoke to update the height solved the problem. Any way of passing parameters using this though?? |
|
Back to top |
|
|
Chris Miller
Joined: 27 Mar 2004 Posts: 514 Location: The Internet
|
Posted: Sat Sep 30, 2006 7:38 pm Post subject: |
|
|
I changed the layout code in the new snapshot, please let me know how it works out!
I also added an overload for delayInvoke: final void delayInvoke(void function(Control, size_t[]) fn, size_t[] params ...)
e.g. Code: |
this.delayInvoke(
function(Control ctrl, size_t[] params)
{
ctrl.width = params[0];
ctrl.height = params[1];
},
400, 400);
|
|
|
Back to top |
|
|
rhosking
Joined: 21 Aug 2006 Posts: 14 Location: UK
|
Posted: Sun Oct 01, 2006 5:21 am Post subject: |
|
|
The new snapshot works great! |
|
Back to top |
|
|
|