Insulation Layer


Author
Message
Randy Jean
Randy Jean
StrataFrame User (167 reputation)StrataFrame User (167 reputation)StrataFrame User (167 reputation)StrataFrame User (167 reputation)StrataFrame User (167 reputation)StrataFrame User (167 reputation)StrataFrame User (167 reputation)StrataFrame User (167 reputation)StrataFrame User (167 reputation)
Group: StrataFrame Users
Posts: 105, Visits: 641
The Visual Foxpro framework we currently use has an "i" layer or "insulation" layer which is where all developer changes are recommended take place.  All application instances are then subclassed from this layer vs. directly from the framework vendor's classes. 

Question: does Strataframe have an "insulation" layer to prevent future source upgrades from overwriting developer enhancements?  If not, is it recommended one create their own subclasses and, if so, can the Strataframe wizards, builders, factories, etc. be changed to subclass from this layer?

Thanks in advance,

Randy Jean

Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
You are exactly right and this is typically the norm in the VFP world.  You can definitely create an "i" layer if this is your desire.  But this is not really as necessary as it was in VFP for a number of reasons.  The primary reason has to do with event handling.  Most everything that needs to be "overwritten" in VFP required a method override in order to achieve a different result.  The beauty of .NET and StrataFrame is event handling.  You can manipulate and mold your application to your needs through events rather than inheritance...at least as far as the "i" layer is concerned. 

In fact this is what we initially did early on just out of habit, and if you use frameworks that require method overrides, then this is a must.  But in an event based environment, this is another nice feature that saves the developer time.

If you have the desire to do this, then it is a very easy process.  Simply create an "i" layer class for each control and inherit the control.

FYI, do not use "i" as your prefix.  In .NET this is standard prefix for an interface.  You will want to choose something else to reduce confision later on.

Example
Public Class MyTextBox
     Inherits MicroFour.StrataFrame.UI.Windows.Forms.TextBox

End Class

Randy Jean
Randy Jean
StrataFrame User (167 reputation)StrataFrame User (167 reputation)StrataFrame User (167 reputation)StrataFrame User (167 reputation)StrataFrame User (167 reputation)StrataFrame User (167 reputation)StrataFrame User (167 reputation)StrataFrame User (167 reputation)StrataFrame User (167 reputation)
Group: StrataFrame Users
Posts: 105, Visits: 641
Thanks for the quick response!  Guess I should brush up on events vs. method overrides.  I've seen the move toward events even in the VFP world as the newest version has better event binding.
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
You're right, VFP was starting to get better with events.  But their most recent version doesn't even begin to support events natively.  The problem with VFP is that they were trying to "slap a bandaid" on the problem to support event binding, creation, and handling.  All event processing is at the root level of .NET which makes it truly a viable solution.
Randy Jean
Randy Jean
StrataFrame User (167 reputation)StrataFrame User (167 reputation)StrataFrame User (167 reputation)StrataFrame User (167 reputation)StrataFrame User (167 reputation)StrataFrame User (167 reputation)StrataFrame User (167 reputation)StrataFrame User (167 reputation)StrataFrame User (167 reputation)
Group: StrataFrame Users
Posts: 105, Visits: 641
OK, here's an example of something I know how to do through inheritance, but not sure how to do with events:



Strataframe Labels: I would like the default for all labels to be backcolor = transparent



I know how to do this through subclassing and I know if I I was not using the trial and had Strataframe source I could change the base class (which would not insulate me from future upgrades overwriting my change), but how would I do this using events?



Thanks,

Randy
StrataFrame Team
S
StrataFrame Developer (4.5K reputation)StrataFrame Developer (4.5K reputation)StrataFrame Developer (4.5K reputation)StrataFrame Developer (4.5K reputation)StrataFrame Developer (4.5K reputation)StrataFrame Developer (4.5K reputation)StrataFrame Developer (4.5K reputation)StrataFrame Developer (4.5K reputation)StrataFrame Developer (4.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
You would need to somehow attach to the visiblity changed event of every label within the application and within the event handler, set the back color to transparent.  It is possible with events, but won't find a good place to centralize attaching to all of those events.  You're better off subclassing the StrataFrame label and using that for everything.

You'll also want to be aware that the label inherits it's back color from it's parent, you'll need to set the property after the ParentChanged event in the subclass.  Or, you could override (or shadow) the back color of the form and set it to always return Transparent.

Randy Jean
Randy Jean
StrataFrame User (167 reputation)StrataFrame User (167 reputation)StrataFrame User (167 reputation)StrataFrame User (167 reputation)StrataFrame User (167 reputation)StrataFrame User (167 reputation)StrataFrame User (167 reputation)StrataFrame User (167 reputation)StrataFrame User (167 reputation)
Group: StrataFrame Users
Posts: 105, Visits: 641
This seems to work. Do you see anything wrong with this?





Imports System.Drawing



Public Class OGSFFormControls



Class OGSFLabel

Inherits MicroFour.StrataFrame.UI.Windows.Forms.Label

Public Sub New()

MyBase.New()

TextAlign = ContentAlignment.MiddleRight

Font = New Font("Lucida Sans Typewriter", 8.0!, _

FontStyle.Regular, _

GraphicsUnit.Point, CType(0, Byte))

Height = 12

BackColor = Color.Transparent

End Sub

End Class



End Class


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