Visual Inheritance


Author
Message
Thomas Holste
Thomas Holste
Advanced StrataFrame User (502 reputation)Advanced StrataFrame User (502 reputation)Advanced StrataFrame User (502 reputation)Advanced StrataFrame User (502 reputation)Advanced StrataFrame User (502 reputation)Advanced StrataFrame User (502 reputation)Advanced StrataFrame User (502 reputation)Advanced StrataFrame User (502 reputation)Advanced StrataFrame User (502 reputation)
Group: StrataFrame Users
Posts: 144, Visits: 618
Hi There,

for a larger project I have set up some base-classes but I am coming to the point

where I don't know what to do.

I have build a base form class (mystdFRM) which is a strataframeform with some additional properties and a themed panel.

From this class I build a new class (mysingledatafrm) which has some methods for datahandling and a themed toolstrip with three buttons added (Save,Undo,Exit).

I use this form for simple data-entry like parameter setup or editing data based on a single BO.

So far everything works fine, but what I can't accomplish is to change controls derived from my base-class. For example, if I would like to add a fourth button to a form derived from mysingledatafrm (the one with the toolstrip on it), I can not modify the control, something I could do in VFP.

I found some articles explaining that I should change the modifiers of these controls to "protected friend" but this does not help.

Can anybody tell me, how or if this can be done (VB.NET/VS2010?

Thanks in advance

Thomas
Edhy Rijo
E
StrataFrame VIP (6K reputation)StrataFrame VIP (6K reputation)StrataFrame VIP (6K reputation)StrataFrame VIP (6K reputation)StrataFrame VIP (6K reputation)StrataFrame VIP (6K reputation)StrataFrame VIP (6K reputation)StrataFrame VIP (6K reputation)StrataFrame VIP (6K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Hi Thomas,

Thomas Holste (7/24/2012)
I found some articles explaining that I should change the modifiers of these controls to "protected friend" but this does not help.


Just change the Modifiers to Public for the objects that you want to access from other classes and rebuild the project.

Edhy Rijo

Thomas Holste
Thomas Holste
Advanced StrataFrame User (502 reputation)Advanced StrataFrame User (502 reputation)Advanced StrataFrame User (502 reputation)Advanced StrataFrame User (502 reputation)Advanced StrataFrame User (502 reputation)Advanced StrataFrame User (502 reputation)Advanced StrataFrame User (502 reputation)Advanced StrataFrame User (502 reputation)Advanced StrataFrame User (502 reputation)
Group: StrataFrame Users
Posts: 144, Visits: 618
Hi Edhy,

thanks for your help. I tried setting the modifier to public, but it does not work.

Somewhere on the MSDN-Servers I found a bug-confirmation that visual inheritance does not work with the toolstrip-control. It was quite old (VS2005) but maybe that is still the state of the control.

Have you been able to derive a form with a toolstrip from a baseform and then been able to change the toolstrip in the designer?

Best regards

Thomas
Edhy Rijo
E
StrataFrame VIP (6K reputation)StrataFrame VIP (6K reputation)StrataFrame VIP (6K reputation)StrataFrame VIP (6K reputation)StrataFrame VIP (6K reputation)StrataFrame VIP (6K reputation)StrataFrame VIP (6K reputation)StrataFrame VIP (6K reputation)StrataFrame VIP (6K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Hi Thomas,

I have not tried with the ToolStrip since I don't use the maintenance ToolStrip, I basically follow the logic used in the StrataFlix sample using ActionLinkItems instead since I do have more control over those.

I do remember that once, when I was learning to use SF, I tried to add buttons to the SF toolstrip but couldn't do it and what I did was to hide the buttons I didn't use and add another toolstrip with the buttons I wanted, after that the StrataFlix sample came out and I choose to follow that logic in my designs.

Edhy Rijo

Michel Levy
Michel Levy
Advanced StrataFrame User (575 reputation)Advanced StrataFrame User (575 reputation)Advanced StrataFrame User (575 reputation)Advanced StrataFrame User (575 reputation)Advanced StrataFrame User (575 reputation)Advanced StrataFrame User (575 reputation)Advanced StrataFrame User (575 reputation)Advanced StrataFrame User (575 reputation)Advanced StrataFrame User (575 reputation)
Group: StrataFrame Users
Posts: 193, Visits: 9K
Hi Thomas,

In all my projetcs, I use only derived classes from SF classes (some are derived twice, one from SF, and onother from this first derivation for each kind of project).

Here's how I faced this MaintenanceToolStrip derivation proble: I need to add buttons for Print and Preview, each of them in a detail or full list version, in 2 new dropdown buttons. And I needed to choose these buttons to be dynamically visible or not, for each forms hosting this new maintenance toolstrip, depending of the condition of existing rows or not in the main BO.

So I wrote it inside the designer file itself, in the class definition 

Friend WithEvents ToolStripSeparator As System.Windows.Forms.ToolStripSeparator
Friend WithEvents PRINT As System.Windows.Forms.ToolStripButton
Friend WithEvents PREVIEW As System.Windows.Forms.ToolStripButton
Friend WithEvents mnuPREVIEW As System.Windows.Forms.ToolStripDropDownButton
Friend WithEvents PREVIEWLISTE As System.Windows.Forms.ToolStripMenuItem
Friend WithEvents PREVIEWDETAIL As System.Windows.Forms.ToolStripMenuItem
Friend WithEvents mnuPRINT As System.Windows.Forms.ToolStripDropDownButton
Friend WithEvents PRINTLISTE As System.Windows.Forms.ToolStripMenuItem
Friend WithEvents PRINTDETAIL As System.Windows.Forms.ToolStripMenuItem


and in the InitializeComponent sub:


Private Sub InitializeComponent()

Me.ToolStripSeparator = New System.Windows.Forms.ToolStripSeparator
Me.PRINT = New System.Windows.Forms.ToolStripButton
Me.PREVIEW = New System.Windows.Forms.ToolStripButton
Me.mnuPRINT = New System.Windows.Forms.ToolStripDropDownButton
Me.PRINTLISTE = New System.Windows.Forms.ToolStripMenuItem
Me.PRINTDETAIL = New System.Windows.Forms.ToolStripMenuItem
Me.mnuPREVIEW = New System.Windows.Forms.ToolStripDropDownButton
Me.PREVIEWLISTE = New System.Windows.Forms.ToolStripMenuItem
Me.PREVIEWDETAIL = New System.Windows.Forms.ToolStripMenuItem

Me.SuspendLayout()
'
'ToolStripSeparator
'
Me.ToolStripSeparator.Name = "ToolStripSeparator"
Me.ToolStripSeparator.Size = New System.Drawing.Size(6, 25)
'
'Imprimer
'
Me.PRINT.Image = Global.MLControlesSF.My.Resources.Resources.Printer96
Me.PRINT.ImageTransparentColor = System.Drawing.Color.Magenta
Me.PRINT.Name = "PRINT"


'... and so on


this code works fine for many years, just forgot it.
Thomas Holste
Thomas Holste
Advanced StrataFrame User (502 reputation)Advanced StrataFrame User (502 reputation)Advanced StrataFrame User (502 reputation)Advanced StrataFrame User (502 reputation)Advanced StrataFrame User (502 reputation)Advanced StrataFrame User (502 reputation)Advanced StrataFrame User (502 reputation)Advanced StrataFrame User (502 reputation)Advanced StrataFrame User (502 reputation)
Group: StrataFrame Users
Posts: 144, Visits: 618
Hi Michael,

thanks a lot for your help, I will try it immediately.

Best regards

Thomas
Edhy Rijo
E
StrataFrame VIP (6K reputation)StrataFrame VIP (6K reputation)StrataFrame VIP (6K reputation)StrataFrame VIP (6K reputation)StrataFrame VIP (6K reputation)StrataFrame VIP (6K reputation)StrataFrame VIP (6K reputation)StrataFrame VIP (6K reputation)StrataFrame VIP (6K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Hi Michel,

Nice trick adding the controls via the Designer.  Thanks!!!

Edhy Rijo

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