Solved

Using a TEditMask

Posted on 2002-05-21
16
1,001 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
 
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
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…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

863 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

24 Experts available now in Live!

Get 1:1 Help Now