Maintenance Form Toolstrip not saving button positions


Author
Message
Jason Stevenson
Jason Stevenson
StrataFrame Beginner (23 reputation)StrataFrame Beginner (23 reputation)StrataFrame Beginner (23 reputation)StrataFrame Beginner (23 reputation)StrataFrame Beginner (23 reputation)StrataFrame Beginner (23 reputation)StrataFrame Beginner (23 reputation)StrataFrame Beginner (23 reputation)StrataFrame Beginner (23 reputation)
Group: Forum Members
Posts: 15, Visits: 43
Guys,

I am trying to add some additional buttons and move the buttons around on the maintenance form toolstrip control.

It appears to save, but after I run the winforms app they are all put back to default positions.

Any ideas?

Jason

Replies
Jason Stevenson
Jason Stevenson
StrataFrame Beginner (23 reputation)StrataFrame Beginner (23 reputation)StrataFrame Beginner (23 reputation)StrataFrame Beginner (23 reputation)StrataFrame Beginner (23 reputation)StrataFrame Beginner (23 reputation)StrataFrame Beginner (23 reputation)StrataFrame Beginner (23 reputation)StrataFrame Beginner (23 reputation)
Group: Forum Members
Posts: 15, Visits: 43
So should we not use the "Edit Items..." option in the upper right menu of the control?

I was able to override the code manually to put things as they should be, but if I use the designer again it of course blows my changes...

Perhaps I should just use a standard toolstrip, but I sure like what you guys have done for speeding up building such a control set...

Thanks again for your help,

Jason

StrataFrame Team
S
StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
The "Edit Items..." option does move the buttons around within the collection, but since the order is already serialized within the MaintenanceFormToolstrip's InitializeComponent() method, it cannot add code within the Form's InitializeComponent() method that can change the order.  So, you would need a method like this:

private void ReOrderToolStrip()
{
//-- Establish locals
ToolStripButton loNew, loBrowse, loEdit, loDelete, loSave, loUndo;

//-- Save the buttons
loNew = this.maintenanceFormToolStrip1.Items[0];
loBrowse =
this.maintenanceFormToolStrip1.Items[1];
loEdit =
this.maintenanceFormToolStrip1.Items[2];
loDelete =
this.maintenanceFormToolStrip1.Items[3];
loSave =
this.maintenanceFormToolStrip1.Items[4];
loUndo =
this.maintenanceFormToolStrip1.Items[5];

//-- Clear the buttons
this.maintenanceFormToolStrip1.Items.Clear();

//-- Re-add the buttons in the order you want them
this.maintenanceFormToolStrip1.Items.AddRange(new ToolStripItem[]
{ loSave, loUndo, loNew, loEdit, loDelete, loBrowse });
}

You'll also need to add any ToolStripSeparators you want.


StrataFrame Team
S
StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
What I will do, is look into the possibility of adding properties that will allow you to set the order of the buttons.
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search