Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4273118
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T07:40:10+00:00 2026-05-21T07:40:10+00:00

Delphi 7 question. I’m working with a form that has many databound controls (changing

  • 0

Delphi 7 question. I’m working with a form that has many databound controls (changing this is not an option). I have a TDBEDIT control bound to a TStringField (which has a EditMask property). I know I can use this EditMask to force the control to validate its input, but what I want to know is if I can populate the field directly with the raw value and have the control display it according to the EditMask?

I want to populate the field with a 16 digit number, but I want it displayed as 4 lots of 4 digits (ie. 9999 9999 9999 9999).

If I do …

dbedtABCNumber.DataSource.DataSet.Edit;
dbedtABCNumber.Field.Value := '1234567812345678';

I only get the first 4 digits displayed.

I hope there’s someone out there who’s more familiar with the intracacies of old databound controls.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T07:40:11+00:00Added an answer on May 21, 2026 at 7:40 am

    You can use the TField.OnGetText event or TNumericField.DisplayFormat property to modify how the text is being displayed.

    Since you have a TStringField holding numbers, you have two choices:

    • use a TNumericField and the DisplayFormat property
    • use the OnGetText event and do your own string formatting

    Edit:

    Sam used this approach:

    I implemented OnSetText and OnGetText event handlers. I already had the Edit Mask 9999 9999 9999 9999;1;_ so the OnSetText was just

    TStringField(Sender).Value := Trim(Text);
    

    and OnGetText was just

    sValue := TStringField(Sender).Value;  
    Text := Format('%s %s %s %s', [Copy(sValue, 1, 4), Copy(sValue, 5, 4), Copy(sValue, 9, 4), Copy(sValue, 13, 4)]);
    

    It works fine. Thanks.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Following up on this question, I'm working on a large Delphi 7 codebase which
This question involves Delphi and XE specifically deprecating Suspend and Resume. I have read
Background: This question relates to versions of Delphi below 2009 (ie without Unicode support
Delphi has a $WARN compiler directive that allows one to selectively enable or disable
This is related to another Delphi-version question but still different; I'm looking for a
I just read this question and this question , and since then I have
This is a very simple question. What should I write in Delphi post build
I have a beginner question using pointers in delphi. I create an object and
I had a similar question to this here: Delphi XE - should I use
We have a COM dll written in delphi in our bin folder that call

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.