Visual Inheritance

Author Message
 Posted 7/24/2012 8:38:45 AM
StrataFrame User

StrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame User

Group: StrataFrame Users
Last Login: 9/23/2016 12:28:17 AM
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
Post #31292
Add to Twitter Add to Facebook
 Posted 7/24/2012 9:03:26 AM
StrataFrame VIP

StrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIP

Group: StrataFrame Users
Last Login: 4/9/2021 12:42:36 PM
Posts: 2,436, Visits: 24,184
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
(Using VB.Net 2019/SQL Server 2017)
Post #31294
Add to Twitter Add to Facebook
 Posted 7/25/2012 3:38:39 AM
StrataFrame User

StrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame User

Group: StrataFrame Users
Last Login: 9/23/2016 12:28:17 AM
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
Post #31295
Add to Twitter Add to Facebook
 Posted 7/25/2012 3:46:19 AM
StrataFrame VIP

StrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIP

Group: StrataFrame Users
Last Login: 4/9/2021 12:42:36 PM
Posts: 2,436, Visits: 24,184
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
(Using VB.Net 2019/SQL Server 2017)
Post #31296
Add to Twitter Add to Facebook
 Posted 7/25/2012 5:05:55 AM
StrataFrame User

StrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame User

Group: StrataFrame Users
Last Login: 11/7/2018 2:37:04 AM
Posts: 193, Visits: 9,066
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.
Post #31297
Add to Twitter Add to Facebook
 Posted 7/25/2012 5:10:03 AM
StrataFrame User

StrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame User

Group: StrataFrame Users
Last Login: 9/23/2016 12:28:17 AM
Posts: 144, Visits: 618
Hi Michael,

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

Best regards

Thomas
Post #31299
Add to Twitter Add to Facebook
 Posted 7/25/2012 5:30:38 AM
StrataFrame VIP

StrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIP

Group: StrataFrame Users
Last Login: 4/9/2021 12:42:36 PM
Posts: 2,436, Visits: 24,184
Hi Michel,

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


Edhy Rijo
(Using VB.Net 2019/SQL Server 2017)
Post #31300
Add to Twitter Add to Facebook


Similar Topics

Expand / Collapse

Reading This Topic

Expand / Collapse

Site Map - Home - My Account - Forum - About Us - Contact Us - Try It - Buy It

Microsoft, Visual Studio, and the Visual Studio logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries.