Solved

Using a TEditMask

Posted on 2002-05-21
16
993 Views
Last Modified: 2012-05-04
I want to have a field in outlook that is in the format

{1234567890123456789012345678901234567890};Joe Smith;

The first part is an entryid of a contact item in outlook, which is always a set length, the second part is the contacts name.

I would like to have field control that only displays the name data and not the entryid data.

The question is can I do this with a mask, and if so, what would the syntax look like for the mask. I also don't want the entryid text to appear if the insertion point is entered into the field. In fact the contact name and entryid data cannot be entered manually, rather it will be filled from another form.

Is this possible with a mask, or do i need something a little different?

Jay
0
Comment
Question by:JazC
  • 7
  • 4
  • 2
  • +3
16 Comments
 
LVL 9

Expert Comment

by:ginsonic
Comment Utility
Maybe use POS function to find ; simbol and then use Copy function to copy from ; to end .
0
 
LVL 9

Accepted Solution

by:
ginsonic earned 150 total points
Comment Utility
Sample:

var s:string;
    x:integer;
begin
 s:='{1234567890123456789012345678901234567890};Joe Smith';
 x:=Pos(';',s);
 Edit.Text:=Copy(s,x+1,(Length(s)-x)+1);
end;

0
 
LVL 9

Expert Comment

by:ginsonic
Comment Utility
To get the first part of the string :

Edit2.Text:=Copy(s,1,x-1);
0
 
LVL 17

Assisted Solution

by:geobul
geobul earned 150 total points
Comment Utility
Hi,

You may use OnChange event of a TEdit component:

procedure TForm1.Button1Click(Sender: TObject);
begin
  Edit1.Text := '{1234567890123456789012345678901234567890};Joe Smith';
end;

procedure TForm1.Edit1Change(Sender: TObject);
var
   iPos: integer;
begin
  if (Sender is TEdit) then begin
    with (Sender as TEdit) do begin
      iPos := Pos(';',Text);
      if iPos > 0 then Text:=Copy(Text, iPos+1, (Length(Text) - iPos) + 1);
    end;
  end;
end;

Regards, Geo
0
 
LVL 9

Expert Comment

by:ginsonic
Comment Utility
Look similar with my idea . Don't think ?
0
 
LVL 17

Expert Comment

by:geobul
Comment Utility
My idea is to use OnChange event of a regular TEdit component do do the desired task. The code implementation is actually the same, of course.

Regards, Geo
0
 
LVL 17

Expert Comment

by:geobul
Comment Utility
(... do do ...) should be (... to do ...)
0
 

Expert Comment

by:pingbaoshi
Comment Utility
I think so
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 9

Expert Comment

by:ginsonic
Comment Utility
Some body with a new face :) Just a joke .

I belive that JazC don't wish to type alike strings .
He want ( I think ) to read from a list a specified alike string and to display just the name part ( to display or modify the contact name ? )

So in my opinion your solution isn't desired one ( maybe I'm wrong and he really want to type alike strings ).

Anyway hope to solve JazC's problem .

Nick
0
 
LVL 9

Expert Comment

by:ginsonic
Comment Utility
If I have this problem, I will use a string array to do this job . Store ID and names . When choice a name (ID) get the correspondent ID (name).
Can modify what I need and when need to use just glue the ID+';'+name.

Sorry for my bad english .
0
 
LVL 17

Expert Comment

by:geobul
Comment Utility
OnChange event is fired when the Text property is changed. It doesn't matter if it has been changed manually (using keyboard) or via code (assignment) as it's in my example above.

Using OnChange you don't need to call any special convertion function explicitly every time when you are assigning a new value to the Text property. Just like an output mask would do. And that's our goal I think.

Regards, Geo
0
 
LVL 9

Expert Comment

by:ginsonic
Comment Utility
I know that . And this is the similarity .
You convert when receive the text (inside OnChange) and I send already converted text.

Bouth codes do same work but at different moments.

But let's stop this topic. We can talk for a long time about ... :) Let's help people .
0
 

Author Comment

by:JazC
Comment Utility
The big thing is, this will be in an ActiveX control, the ActiveX control will reside in a Outlook econtact Form. The control can be bound by one piece of Data.

After saying that i thinkk I have answered my own question, just store the real value in a property that is bound, but only display the text name of the contact in a text box

Maybe I should have just slept on the idea for a night, I only came up with the idea yesterday.

Anyway, I will try it and see if I get a desired result.

Will get back to you people by the end of today.

Jay
0
 
LVL 1

Expert Comment

by:pnh73
Comment Utility
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Split between geobul and ginsonic

Please leave any comments here within the next seven days.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 
Paul (pnh73)
EE Cleanup Volunteer
0
 

Author Comment

by:JazC
Comment Utility
Split between geobul and ginsonic
0
 

Expert Comment

by:CleanupPing
Comment Utility
JazC:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
This video discusses moving either the default database or any database to a new volume.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now