StrataFrame Forum

I want to add some custom buttons to the maintenance toolbar in the maintenance form

http://forum.strataframe.net/Topic19533.aspx

By Marcia G Akins - 9/18/2008

Hi All?

This one should be fairly straight-forward Smile

Thanks!

By Marcia G Akins - 9/19/2008

Well, here I am talking to myself again Tongue I tried the obvious and created an event handler for the toolbar's ItemClicked event and it worked. The thing that I was concerned about was if there was code up the inheritance hierarchy, I did not want to over-ride it. However, I tried to step into it, and apparently there was no code up the hierarchy. So I am curious, where is the magic code that handles when the add, edit and other buttons in the toolbar are clicked.

Also, in VFP I know that I can call up the inheritance hierarchy by using DODEFAULT(). What is the equivalent was to do this in C#?

Thanks

By Trent L. Taylor - 9/22/2008

Well, if you want to control the event order then you will want to subclass the item and the override the ItemClicked.  In this case you would call base.MemberName.

base.MemberName

You will want to do this when overriding an On method so that you can control whether your code is executed before or after other event handlers. 

By Marcia G Akins - 9/23/2008

Trent L. Taylor (09/22/2008)
Well, if you want to control the event order then you will want to subclass the item and the override the ItemClicked.  In this case you would call base.MemberName.

base.MemberName

You will want to do this when overriding an On method so that you can control whether your code is executed before or after other event handlers. 

Do I have to subclass the item? Can't I just put this code in the form instance?

By Trent L. Taylor - 9/24/2008

This would have to be a sublass to call the base like this.  If you are within a form and wanting to call the base.MemberName of a method on the form from which you are inherited it would work fine.  However, if you are on a form and want to call the base for a button on the form, that would not work.  All base methods (unless exclicitly exposed) will be protected which would prevent you from doing this...so you would have to subclass in this case.

I may not be entirley sure of what you are trying to accomplish, but in regards to inheritance and calling a base member, this is how encapsulation and .NET are designed...as they should be.  VFP was really bad about enforcing encapsulation...we like to refer to VFP as "decapsulated" BigGrin  When we go back and look at old code we always laugh at what we had done...now being "pure and clean" Tongue

By Marcia G Akins - 9/28/2008

Trent L. Taylor (09/24/2008)
This would have to be a sublass to call the base like this.  If you are within a form and wanting to call the base.MemberName of a method on the form from which you are inherited it would work fine.  However, if you are on a form and want to call the base for a button on the form, that would not work.  All base methods (unless exclicitly exposed) will be protected

If I understand you correctly, this would be a consequence of the fact that .NET does not implement a strong containership model. Or am I on Mars Tongue ?