Solved

Using a TEditMask

Posted on 2002-05-21
16
1,006 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 150 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
Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

 
LVL 17

Assisted Solution

by:geobul
geobul earned 150 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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

810 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