Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2002-09

Why won't modal result work for me?

3 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Tony Maro

I have a form with a button that has this:

procedure TFrmNewSchedDep.BtnOkCLICK(Sender: TObject);
begin
     ModalResult := mrOk;
     self.close;
end;

When clicked the form closes, but the result is always mrCancel.

Thanks,
Tony

Reply by email

Andrew Johnson
ModalResult := mrOk; self.close; The result is always mrCancel.

1st You don't call close on a ShowModal form. You just set the result, and it automatically closes. 2nd, I forgot to check to make sure that the modalresult wan't set before changing it on hide. Get rid of the close, and it should work fine. I will fix the other problem soon, its just missing an if..then.

Andrew

_________________________________________________________________ Join the world�s largest e-mail service with MSN Hotmail. http://www.hotmail.com

Reply by email