Subclassing DevEx.TextEdit


Author
Message
Ger Cannoll
Ger Cannoll
Advanced StrataFrame User (628 reputation)Advanced StrataFrame User (628 reputation)Advanced StrataFrame User (628 reputation)Advanced StrataFrame User (628 reputation)Advanced StrataFrame User (628 reputation)Advanced StrataFrame User (628 reputation)Advanced StrataFrame User (628 reputation)Advanced StrataFrame User (628 reputation)Advanced StrataFrame User (628 reputation)
Group: StrataFrame Users
Posts: 430, Visits: 507
Hi Edhy.

Yes. Most of properties are at the root (e.g. .Font  , .MaximumSize etc.)  but there are a good number then in a section called Properties , and one of these is MaxLength
Edhy Rijo
E
StrataFrame VIP (4.5K reputation)StrataFrame VIP (4.5K reputation)StrataFrame VIP (4.5K reputation)StrataFrame VIP (4.5K reputation)StrataFrame VIP (4.5K reputation)StrataFrame VIP (4.5K reputation)StrataFrame VIP (4.5K reputation)StrataFrame VIP (4.5K reputation)StrataFrame VIP (4.5K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Hi Gerard,
Thanks for the clarification.  So the property name in DevExpress is Property.MaxLentgh then.

Edhy Rijo

Ger Cannoll
Ger Cannoll
Advanced StrataFrame User (628 reputation)Advanced StrataFrame User (628 reputation)Advanced StrataFrame User (628 reputation)Advanced StrataFrame User (628 reputation)Advanced StrataFrame User (628 reputation)Advanced StrataFrame User (628 reputation)Advanced StrataFrame User (628 reputation)Advanced StrataFrame User (628 reputation)Advanced StrataFrame User (628 reputation)
Group: StrataFrame Users
Posts: 430, Visits: 507
Iseem to have this fully working now..many thanks for all contributions.

I did run into one little issue. When I amneded the SF Source Code for the Inherited textEdit, I 'noticed'  that there was not a MaxLength property. So. ok I wrote the code to 'Create' a new Maxlength property in the subclassed TexEdit control. Of course this made no difference when Iran the code . I then went back and noticed that ther was a Maxlength property already there , but it was in a 'Property' property. Just for lurkers may save a bit of time !!
Edhy Rijo
E
StrataFrame VIP (4.5K reputation)StrataFrame VIP (4.5K reputation)StrataFrame VIP (4.5K reputation)StrataFrame VIP (4.5K reputation)StrataFrame VIP (4.5K reputation)StrataFrame VIP (4.5K reputation)StrataFrame VIP (4.5K reputation)StrataFrame VIP (4.5K reputation)StrataFrame VIP (4.5K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Hi Gerard,

The code is in the TextBox.vb class in the MicroFour StrataFrame UI project's source code.  Take a look at the AutoAdjustMaxLength property and the UpdateMaxLength() method.  You can copy that to the TextEdit class in the SF DevExpress Wrapper source, then recompile and all should be good.

Edhy Rijo

Ger Cannoll
Ger Cannoll
Advanced StrataFrame User (628 reputation)Advanced StrataFrame User (628 reputation)Advanced StrataFrame User (628 reputation)Advanced StrataFrame User (628 reputation)Advanced StrataFrame User (628 reputation)Advanced StrataFrame User (628 reputation)Advanced StrataFrame User (628 reputation)Advanced StrataFrame User (628 reputation)Advanced StrataFrame User (628 reputation)
Group: StrataFrame Users
Posts: 430, Visits: 507
I am trying to SubClass the DevEx TextEdit control and use the AutoAdjustMaxLength property thats in the SF TextBox.

If this is now included as standard, could someone point me in the right direction, if not , some pointers to where the code is in the SF Source Code, or if somebody has already done it in C#, that would be very useful 
Bill Cunnien
Bill Cunnien
StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)
Group: Forum Members
Posts: 785, Visits: 3.6K
After all of the fun, I have the following functioning code. It is not much different than where I started before attempting to recreate the SF code.



using MicroFour.StrataFrame.Business;

using System;

using System.Data;

using System.Drawing;



namespace Aspire.SubclassedControls.DevEx

{

public class TextEdit : MicroFour.StrataFrame.UI.Windows.Forms.DevEx.TextEdit

{

public TextEdit()

{

InitializeControl();

}



private void InitializeControl()

{

Properties.AppearanceDisabled.BackColor = Color.FromName("Info");

Properties.AppearanceDisabled.ForeColor = Color.FromName("InfoText");

Properties.AppearanceReadOnly.BackColor = Color.FromName("Info");

Properties.AppearanceReadOnly.ForeColor = Color.FromName("InfoText");

}



protected override void OnBindingContextChanged(EventArgs e)

{

base.OnBindingContextChanged(e);

if ((BusinessObject != null) && (BindingField != String.Empty))

{

if (((BusinessLayer)BusinessObject).FieldDbTypes[BindingField] == DbType.AnsiString)

Properties.MaxLength = ((BusinessLayer)BusinessObject).FieldLengths[BindingField];

}

}

}

}


Bill Cunnien
Bill Cunnien
StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)
Group: Forum Members
Posts: 785, Visits: 3.6K
I pulled the appearance properties out of the if-statement. That should take care of that piece of the puzzle. Silly me.



As far as the copy/paste routine....yup, that is what I do. I lose all of the indentation, though.



Perhaps, it a Google Chrome thing.
Charles R Hankey
Charles R Hankey
Advanced StrataFrame User (892 reputation)Advanced StrataFrame User (892 reputation)Advanced StrataFrame User (892 reputation)Advanced StrataFrame User (892 reputation)Advanced StrataFrame User (892 reputation)Advanced StrataFrame User (892 reputation)Advanced StrataFrame User (892 reputation)Advanced StrataFrame User (892 reputation)Advanced StrataFrame User (892 reputation)
Group: Forum Members
Posts: 524, Visits: 30K
I'm calling initializecomponent and you're calling initializecontrol ?



I just copied the code from my class in vs and pasted between the codesnippet ifcodes. Get it indented in VS is an IDE options thing.

Bill Cunnien
Bill Cunnien
StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)
Group: Forum Members
Posts: 785, Visits: 3.6K
btw, how do you get your posted code to have the indentation...I knew once how to do it. I've forgotten.
Bill Cunnien
Bill Cunnien
StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)
Group: Forum Members
Posts: 785, Visits: 3.6K
Thanks for working this out with me. Here is the code that I am using:





using MicroFour.StrataFrame.Business;

using System;

using System.Data;

using System.Drawing;



namespace Aspire.SubclassedControls.DevEx

{

public class TextEdit : MicroFour.StrataFrame.UI.Windows.Forms.DevEx.TextEdit

{

public TextEdit()

{

InitializeControl();

}



private void InitializeControl()

{

if ((BusinessObject != null) && (BindingField != String.Empty))

{

Properties.AppearanceDisabled.BackColor = Color.FromName("Info");

Properties.AppearanceDisabled.ForeColor = Color.FromName("InfoText");

Properties.AppearanceReadOnly.BackColor = Color.FromName("Info");

Properties.AppearanceReadOnly.ForeColor = Color.FromName("InfoText");

if (((BusinessLayer)BusinessObject).FieldDbTypes[BindingField] == DbType.AnsiString)

Properties.MaxLength = ((BusinessLayer)BusinessObject).FieldLengths[BindingField];

}

}

}

}





Looks quite similar to your's, eh?

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