Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.

Welcome, Guest
Guest Settings

Thread: Subclassing TSpinEdit

Permlink Replies: 1 - Last Post: Nov 4, 2017 4:28 AM Last Post By: Mark Williams Threads: [ Previous | Next ]
Karl-Heinz warn...

Posts: 22
Registered: 10/21/00
Subclassing TSpinEdit
Click to report abuse...   Click to reply to this thread Reply
  Posted: Oct 14, 2017 5:51 AM

I would like to build a new SpinEdit with the possibility to show the
ASCII Char belonging to the value. For example the Value is 61dez and
the SpinEdit should show the "A".

Therefore I must in a Subclass (MySpinEdit) overwrite the Methods
GetValue and SetValue. But this are private in TSpinEdit.

Is there another possibility other then change the original source?

If no, how can I rebuild the changed Package dclsmp250 (Samples) and
what is with vclsmp/vclsmp250?

Thanks for help


Mark Williams

Posts: 120
Registered: 5/8/10
Re: Subclassing TSpinEdit
Click to report abuse...   Click to reply to this thread Reply
  Posted: Nov 4, 2017 4:28 AM   in response to: Karl-Heinz warn... in response to: Karl-Heinz warn...

I created my own component derived from TCustomEdit, but I utilised a lot of the code in TSpinEdit class.

The component provides for integer or decimal values. It also permit prefixes and suffixes (within certain constraints). It may be fairly easy to adapt it to do what you want it to do.

I just tested it adding the following code: MWCSpinEdit1.Suffix := '='+chr(trunc(MWCSpinEdit1.Value));

This then displays the integer value and the ascii char as you spin eg "65 =A".

If you just wanted to show just the "A" and not the integer value, it would probably be very easy to manipulate the control to do so.

I also created a spinedit control which returns a text value, but which provides onupclick and ondownclick events. Internally it does nothing itself. You have to place your own code in the up and down events. You would also have to keep track within your app of the entered integer value or convert the character in the spinedit in order for the spinup and spindown events to know where to go next.

If you would like me to send the source code for either of these components please send me your email address
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02