Topic: Need a little help with a Script (easy)

I managed to overwrite my script.pas file and I'm having to start over. I have a simple script for saving a email address, and then the address shows up as a link.. I do it on two forms. The problem I'm having is that it works on one form, but not on the other. Need some fresh eyes...

procedure form1_Edit1_OnChange (Sender: string);
begin
    if Pos('@', Form1.Edit1.Text)>0 then
    begin
        Form1.Edit1.Cursor := crHandPoint;
        Form1.Edit1.Font.Style:=fsUnderline;
        Form1.Edit1.Font.Color := clHotLight;
    end
    else
    begin
        Form1.Edit1.Cursor := crDefault;
        Form1.Edit1.Font.Style:=0;
        Form1.Edit1.Font.Color := clDefault;
    end;
    MessageDlgTimeOut('You are here:  Form1_Edit1_onChange', 'Form1', MB_YESNO+MB_ICONINFORMATION, 2000); // 2 seconds
end;

procedure Form1_Edit1_OnDoubleClick (Sender: string);
begin
    OpenFile('mailto:'+Form1.Edit1.Text);
end;

procedure PetTransport_Email_OnChange (Sender: string);
begin
    if Pos('@', PetTransport.Email.Text)>0 then
    begin
        PetTransport.Email.Cursor := crHandPoint;
        PetTransport.Email.Font.Style:=fsUnderline;
        PetTransport.Email.Font.Color := clHotLight;
    end
    else
    begin
        PetTransport.Email.Cursor := crDefault;
        PetTransport.Email.Font.Style:=0;
        PetTransport.Email.Font.Color := clDefault;
    end;
    MessageDlgTimeOut('You are here:  PetTransport_Email_OnChange', 'Pet Transport', MB_YESNO+MB_ICONINFORMATION, 2000); // 2 seconds
end;

procedure PetTransport_Email_OnDoubleClick (Sender: string);
begin
    OpenFile('mailto:'+PetTransport.Email.Text);
end;

begin
    StartPage.mniAbout.Visible := False;
    StartPage.mniOptions.Visible := False;
    StartPage.mniFile.Visible := False;
end.

The email link work just fine on Form1, but not on the "PetTransport" form. The message box works on Form1 but not on PetTransport. So I don't think it's ever making it to that part of the code. I would appreciate any help

Nothing inspires forgiveness quite like revenge.

Scott Adams

Re: Need a little help with a Script (easy)

Please attach your project (zip file without exe and dll)

Dmitry.

Re: Need a little help with a Script (easy)

Hi Dmitry. Here's pretty much everything without the dll and exe.

Post's attachments

Attachment icon Contacts.7z 842.91 kb, 383 downloads since 2015-12-02 

Nothing inspires forgiveness quite like revenge.

Scott Adams

Re: Need a little help with a Script (easy)

Hello,


You can't just copy event procedure, here you can find info, how to create events for components:
http://myvisualdatabase.com/help_en/scr … rview.html



Thanks.

Dmitry.

Re: Need a little help with a Script (easy)

BIG thank you Dmitry. After reading the link, I had everything working in no time. For me, I just learned something huge!! Now scripts are going to be SO much easier smile

Nothing inspires forgiveness quite like revenge.

Scott Adams