Winform patches

"Simon Guindon" <[email protected]>
Newsgroups gmane.comp.gnu.dotgnu.developer
Message-ID <000b01c4bbca$7e268ca0$6400000a@amdxp>
Hey all,

I hit a few bugs in PNET Winforms this week, I've been in the process of porting my IM application to PNET from .NET

Basically one was in StatusBar, where StatusBar was using the Form's BackColor, how most controls work, but on .NET StatusBar uses SystemColors.Control, so I fixed, and I have a patch here for, since I was the one who wrote StatusBar

statusbar.patch

Now my big issue.  During testing, I found some layout bugs.  I decided to attempt to debug and fix these issues myself instead of just posting the bug.  I'm not sure if my solution is good, so I'm hoping for some feedback from the community.

Basically this is how the form should look like:
(Notice the Tasks control, is anchored top, left, right, so the edges follow the window resizing)

http://home.sse.net/nexxia3.jpg

Now here is the app on PNET:
(Notice the Tasks control isn't fully to the right)

http://home.sse.net/nexxia1.jpg

So after some struggles, I think I sorta know the issue.  Basically the Tasks control is built using UserControl, not Control.

In the Tasks VS.NET project, its sized at 156, so this is the size its getting, but its dragged and dropped, and resized on the IM apps Form, with a size of 244, which isn't being updated on PNET.

Now in Control.Size property, nowhere does it update the layout.  So in my patch, after setting the new sizes, I added a call to 
PerformActualLayout();

And now it seems to work great, everything is suddenly fixed.  So is this a good solution?  What happens if SuspendLayout occurs, and the Control's size is changed, it shouldn't PerformActualLayout not occur, but how does the object update.

I'm quite confused, but I'm impressed I got it fixed, but I think you guys will let me know that is the wrong fix.  I would like to know if there are any better options or if this is acceptable?  I know the Trumpf project has been having various layout issues.  I haven't seen this issue occur on a Control derived control, so far only my UserControl one.

Anyways thanks for listening.

Any help is greatly appreciated.  Please commit the patches if you think I solved the issues nicely.

Take care.
statusbar.patch (application/octet-stream, 894 B)
# Patch created by root
# Date: Tue Oct 26 21:56:21 EDT 2004
# Repository: pnetlib
# Comments:
# Fixed StatusBar BackColor if not set showing up as its Form BackColor,
# when it should show up as SystemColors.Control.
#### End of Preamble ####

#### Patch data follows ####
Index: System.Windows.Forms/StatusBar.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/System.Windows.Forms/StatusBar.cs,v
retrieving revision 1.7
diff -c -r1.7 StatusBar.cs
*** System.Windows.Forms/StatusBar.cs	28 Sep 2003 22:06:36 -0000	1.7
--- System.Windows.Forms/StatusBar.cs	27 Oct 2004 01:58:01 -0000
***************
*** 46,51 ****
--- 46,52 ----
  			Dock = DockStyle.Bottom;
  			showPanels = false;
  			sizingGrip = true;
+ 			BackColor = SystemColors.Control;
  			panels = new StatusBarPanelCollection(this);
  		}
  
#### End of Patch data ####
control.patch (application/octet-stream, 951 B)
# Patch created by root
# Date: Tue Oct 26 20:46:45 EDT 2004
# Repository: pnetlib
# Comments:
# Fixed anchoring/docking not being updated when Control.Size was changed.
#### End of Preamble ####

#### Patch data follows ####
Index: System.Windows.Forms/Control.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/System.Windows.Forms/Control.cs,v
retrieving revision 1.79
diff -c -r1.79 Control.cs
*** System.Windows.Forms/Control.cs	26 Oct 2004 15:48:54 -0000	1.79
--- System.Windows.Forms/Control.cs	27 Oct 2004 00:48:38 -0000
***************
*** 1650,1655 ****
--- 1650,1659 ----
  				{
  					SetBoundsCore(left, top, value.Width, value.Height,
  						BoundsSpecified.Size);
+ 
+ 					// Make sure we update the anchoring/docking system when we change the size
+ 					// of a parent.
+ 					PerformActualLayout();
  				}
  			}
  #if CONFIG_COMPONENT_MODEL
#### End of Patch data ####
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.