?
Solved

Using a TEditMask

Posted on 2002-05-21
16
Medium Priority
?
1,029 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
ID: 7026163
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 600 total points
ID: 7026173
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
ID: 7026180
To get the first part of the string :

Edit2.Text:=Copy(s,1,x-1);
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 17

Assisted Solution

by:geobul
geobul earned 600 total points
ID: 7026307
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
ID: 7026339
Look similar with my idea . Don't think ?
0
 
LVL 17

Expert Comment

by:geobul
ID: 7026365
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
ID: 7026374
(... do do ...) should be (... to do ...)
0
 

Expert Comment

by:pingbaoshi
ID: 7026663
I think so
0
 
LVL 9

Expert Comment

by:ginsonic
ID: 7026718
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
ID: 7026727
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
ID: 7026772
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
ID: 7027028
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
ID: 7028200
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
ID: 9006574
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
ID: 9007865
Split between geobul and ginsonic
0
 

Expert Comment

by:CleanupPing
ID: 9343201
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 Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Integration Management Part 2
Screencast - Getting to Know the Pipeline
Suggested Courses

864 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