StrataFrame Forum

How to access GradientFormHeader properties?

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

By Edhy Rijo - 10/9/2008

When you create a new instance of a form which has a GradientFormHeader I have found no way to access the GradientFormHeader properties like Title and DetailText pretty much like we can do with a BrowserDialog.HeaderTitle, I would like to be able to do this:

Dim f As New ReportViewerDialog()

f.rptViewer.HeaderTitle = "My nice header title"

f.rptViewer.DetailText = "My nice detail text sample"

Can this be done now, or will this fall into an Enhancement Request?

Thanks!

By Greg McGuffey - 10/9/2008

What I've done is just expose those properties via public properties of the form:



Public Property Title As String

  Get

    Return Me.GradientHeader1.Title

  End Get

  Set(value As String)

    Me.GradientHeader1.Title = value

  End Set

End Property




The other option would be to make the gradient header public, using the Modifier property:







Then you could use code like:



MyForm.GradientHeader1.Title = "My Title"




I don't see any way for SF to know how you'd compose your forms to automatically provide this sort of functionality though. Fortunately it's not hard to get working though! BigGrin
By Edhy Rijo - 10/9/2008

Thanks Greg,

That is exactly what I needed, they both work fine.  I choose to create the custom properties since that will make more sense to set at the form level like f.Title instead of f.GradientFormHeader.Title.

By Greg McGuffey - 10/9/2008

Glad it worked. My preference in a situation like this would be the custom properties too....but I like choice BigGrin
By Trent L. Taylor - 10/10/2008

This will work, but I might suggest creating properties to expose the title, etc. instead of just exposing the object.  Technically this violates encapsulation and if you were to rename the gradient form header, all of your programs would break.  But if you had a property on your base form called Title, or HeaderImage, then it would only be a matter of changing this in the base form versus every program in your app that has referenced this object.  Just a thought and recommendation.
By Edhy Rijo - 10/10/2008

Thank you Trent, got it!