Keeping button controls in sync with MaintenanceFormToolStrip items


Author
Message
franka
franka
StrataFrame Beginner (28 reputation)StrataFrame Beginner (28 reputation)StrataFrame Beginner (28 reputation)StrataFrame Beginner (28 reputation)StrataFrame Beginner (28 reputation)StrataFrame Beginner (28 reputation)StrataFrame Beginner (28 reputation)StrataFrame Beginner (28 reputation)StrataFrame Beginner (28 reputation)
Group: Forum Members
Posts: 22, Visits: 35
I have a form that has New, Edit, Delete, Save and Undo buttons.  I want to keep those buttons in sync with the items on the MaintenceFormToolStrip.  I've tried the following code in both the ItemClicked event of the MaintenanceFormToolStrip and the EditingStateChanged event of the primary BO but they don't stay in sync.  Suggestions?  Thanks!!

Me.btnNew.Enabled = Me.MaintenanceFormToolStrip1.Items(0).Enabled

Me.btnEdit.Enabled = Me.MaintenanceFormToolStrip1.Items(3).Enabled

Me.btnDelete.Enabled = Me.MaintenanceFormToolStrip1.Items(4).Enabled

Me.btnSave.Enabled = Me.MaintenanceFormToolStrip1.Items(6).Enabled

Me.btnUndo.Enabled = Me.MaintenanceFormToolStrip1.Items(7).Enabled


Reply
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
You would probably do best to handle the form's EditingStateChanged event which gets raised for each business object.  The problem with testing on the enabled state of the MaintenanceFormToolstrip is that it may not be set, yet... events get handled in whatever order the delegate feels like invoking them (two handlers on the same event are not guaranteed to fire in any specific order...).  So, your best bet is to look at the source code for the handler of the EditingStateChanged event within the MaintenanceFormToolstrip.  It cycles through the collections of business objects that are selected through the IncludeInForm*** properties and handles the events appropriately.  It might be easier to just copy that code over Smile
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