bugDotGNU Portable.NET - Bugs: bug #10394, Control.cs Add(..) does not show...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #10394: Control.cs Add(..) does not show the control if the control initially was removed

Submitted by:  Heiko Weiss <brubbel>
Submitted on:  Wed 15 Sep 2004 10:54:17 AM UTC  
 
Category: NoneSeverity: 3 - Normal
Item Group: NoneStatus: Fixed
Privacy: PublicAssigned to: None
Open/Closed: Closed

Mon 22 Nov 2004 02:09:35 PM UTC, comment #3:

works in current cvs.

Klaus Treichel <ktreichel>
Project Administrator
Tue 05 Oct 2004 04:05:34 PM UTC, comment #2:

Seems to work ok, on the CVS build.

Gopal.V <t3rmin4t0r>
Project Administrator
Tue 05 Oct 2004 01:31:00 PM UTC, comment #1:

I added a sample

Heiko Weiss <brubbel>
Project Member
Wed 15 Sep 2004 10:54:17 AM UTC, original submission:

- create a form FF
- in this form you have a Control XX
- remove the control XX from the forms FF Controls collection in the contructure of the form FF
- some time after (e.g. Button Click) add the Control XX to the forms FF Controls collection by this.Controls.Add( XX )

-> the Control XX is not created correctly and is not been displayed

I have made a quick hack in Control.cs:
...
// Add a control to this collection.
public virtual void Add(Control value)
{
if(value != null)
{
if(value.Parent == owner)
{
// We are already under this owner, so merely
// send it to the back of its sibling stack.
value.SendToBack();
}
else
{
// Suspend layout on the parent while we do this.
owner.SuspendLayout();
try
{
// Change the parent to the new owner.
value.Parent = owner;

// Assign the next tab order if the control doesnt have one.
if (value.tabIndex == -1)
{
int lastIndex = 0;
for (int i = 0; i < owner.numChildren; i++)
{
int index = owner.children[i].TabIndex;
if (lastIndex <= index)
lastIndex = index + 1;
}
value.tabIndex = lastIndex;
}

// Initialize layout within the new context.
value.InitLayout();
}
finally
{
// Resume layout, but don't perform it yet.
owner.ResumeLayout(false);
}

// Now perform layout on the control if necessary.
if ( true /* Heiko Weiss: always create control owner.IsHandleCreated && value.Visible */ )
{
// Make sure the control exists.
value.CreateControl();
owner.PerformLayout(value, "Parent");
}
// Notify the owner that the control was added.
owner.OnControlAdded
(new ControlEventArgs(value));
}
}
}
...

Heiko Weiss <brubbel>
Project Member

 

Attached Files
file #1832:  Control.cs.zip added by brubbel (22KiB - application/x-zip-compressed - Sample)

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

Do you think this task is very important?
If so, you can click here to add your encouragement to it.
This task has 0 encouragements so far.

Only logged-in users can vote.

 

Please enter the title of George Orwell's famous dystopian book (it's a date):

 

 

Follow 3 latest changes.

Date Changed By Updated Field Previous Value => Replaced By
Mon 22 Nov 2004 02:09:35 PM UTCktreichelStatusNone=>Fixed
  Open/ClosedOpen=>Closed
Tue 05 Oct 2004 01:31:00 PM UTCbrubbelAttached File-=>Added Control.cs.zip, #1733

Back to the top


Powered by Savane 3.1-cleanup1