FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Possible layout bug in the latest snapshot (20060926)?

 
Post new topic   Reply to topic     Forum Index -> DFL
View previous topic :: View next topic  
Author Message
rhosking



Joined: 21 Aug 2006
Posts: 14
Location: UK

PostPosted: Wed Sep 27, 2006 4:38 am    Post subject: Possible layout bug in the latest snapshot (20060926)? Reply with quote

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
View user's profile Send private message
Chris Miller



Joined: 27 Mar 2004
Posts: 514
Location: The Internet

PostPosted: Wed Sep 27, 2006 2:26 pm    Post subject: Re: Possible layout bug in the latest snapshot (20060926)? Reply with quote

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 Smile
Back to top
View user's profile Send private message
rhosking



Joined: 21 Aug 2006
Posts: 14
Location: UK

PostPosted: Wed Sep 27, 2006 2:34 pm    Post subject: Reply with quote

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
View user's profile Send private message
rhosking



Joined: 21 Aug 2006
Posts: 14
Location: UK

PostPosted: Thu Sep 28, 2006 7:56 am    Post subject: Reply with quote

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
View user's profile Send private message
rhosking



Joined: 21 Aug 2006
Posts: 14
Location: UK

PostPosted: Thu Sep 28, 2006 12:52 pm    Post subject: Reply with quote

Using delayInvoke to update the height solved the problem. Any way of passing parameters using this though??
Back to top
View user's profile Send private message
Chris Miller



Joined: 27 Mar 2004
Posts: 514
Location: The Internet

PostPosted: Sat Sep 30, 2006 7:38 pm    Post subject: Reply with quote

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
View user's profile Send private message
rhosking



Joined: 21 Aug 2006
Posts: 14
Location: UK

PostPosted: Sun Oct 01, 2006 5:21 am    Post subject: Reply with quote

The new snapshot works great! Very Happy
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> DFL All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group