Subclassing DevEx.TextEdit


Author
Message
Charles R Hankey
Charles R Hankey
StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)
Group: Forum Members
Posts: 524, Visits: 30K
I would like to subclass the Microfour.Strataframe.UI.Windows.Forms.DevEx.TextEdit so I don't have to set all the properties each time to get currency box behavior when I drop one on a form (this form will have > 30 ) I will be using this to bind to character fields as well.



I am still a little uncertain as to how masking works in .NET.



I am trying to add a new component, and set the inherits, then set the properties I want in the properties sheet. I get a warning that fProperties has a the exact property in the base class and should be marked Shadows but I'm out of my depth on exactly how to set this up.



I'd be open to any alternative suggestions as to how to create the textbox that will behave right to left, 2 decimals, show with normal backcolor when disabled or readonly etc. The DevEx.TextEdit ( part of the DevExpress freebie in the XtraEditors ) might be the easiest to adapt for my purposes but if anyone has built something else they'd like to share I'd certainly like to see it.



Assume others have been down this path before so I'll look forward to suggestions.



TIA
Reply
Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
You have two options.  Implement the Shadows property and create your own internal privates to set the values on the parent class or create totally new properties that you set and in turn sets the parents base properties.

Private _MyText As String = String.Empty
Public Shadows Property Text As String
    Get
         '-- Make sure that the base property is set when being evaluated
         If Not MyBase.Text.Equals(_MyText) Then MyBase.Text = _MyText
       
         Return _MyText
    End get
    Set(Byval value As String)
          _MyText = value
          MyBase.Text = _MyText
    End Set
End Property

The second option is basically the same, but is slightly harder to implement dynamically as the base class will not automatically evaluate the property, thus requiring you to set each property regardless of the serialized state.

Hope this helps Smile  Also, the above code was quick and dirty and not tested, but it will be close. Wink

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Threaded View
Threaded View
Charles R Hankey - 15 Years Ago
Trent L. Taylor - 15 Years Ago
Charles R Hankey - 15 Years Ago
Charles R Hankey - 15 Years Ago
Bill Cunnien - 15 Years Ago
Charles R Hankey - 15 Years Ago
Bill Cunnien - 15 Years Ago
Greg McGuffey - 15 Years Ago
Charles R Hankey - 15 Years Ago
Bill Cunnien - 15 Years Ago
Bill Cunnien - 15 Years Ago
Greg McGuffey - 15 Years Ago
Bill Cunnien - 15 Years Ago
Bill Cunnien - 15 Years Ago
                         Dude.

Just saw it.

AutoAdjustMaxLength property...
Bill Cunnien - 15 Years Ago
                             Nope...it is NOT on the TextEdit control. Alas!
The control was...
Bill Cunnien - 15 Years Ago
                                 There is no reason for us to do it when you guys are making the change...
Trent L. Taylor - 15 Years Ago
                                     Heh heh...you betcha! I am opening the source code, as we speak....
Bill Cunnien - 15 Years Ago
                                     I am trying to SubClass the DevEx TextEdit control anduse the...
Ger Cannoll - 14 Years Ago
                                         Hi Gerard, The code is in the TextBox.vb class in the MicroFour...
Edhy Rijo - 14 Years Ago
                                             Iseem to have this fully working now..many thanks for all...
Ger Cannoll - 14 Years Ago
                                                 Hi Gerard, Thanks for the clarification. So the property name in...
Edhy Rijo - 14 Years Ago
                                                     Hi Edhy. Yes. Most of properties are at the root (e.g. .Font ,...
Ger Cannoll - 14 Years Ago
Charles R Hankey - 15 Years Ago
Charles R Hankey - 15 Years Ago
Bill Cunnien - 15 Years Ago
Charles R Hankey - 15 Years Ago
Charles R Hankey - 15 Years Ago
Charles R Hankey - 15 Years Ago
Bill Cunnien - 15 Years Ago
Bill Cunnien - 15 Years Ago
Charles R Hankey - 15 Years Ago
Bill Cunnien - 15 Years Ago
Bill Cunnien - 15 Years Ago

Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search