01-04-2012, 05:01 PM
01-04-2012, 05:07 PM
وعليكم السلام
اولا لطلب التاكيد استعمل MessageDlg
اما فيما يخص الامر الاخر وضح اكثر
اولا لطلب التاكيد استعمل MessageDlg
PHP كود :
procedure TForm1.Button1Click(Sender: TObject);
begin
if MessageDlg('هل انت متاكد من رغبتك في الخروج',mtInformation,[mbYes,mbNo],0)=mryes then
Close;
end;
01-04-2012, 06:31 PM
[INDENT]
وعليكم السلام ورحمة الله وبركاته ، و لماذا تنشىء نافذة جديدة ؟
عندك الحدث OnCloseQuery التابع للفورم الرئسي ضع فيه هذا الكود :
أي بمعنى انك تتحكم في قيمة canclose
وفقك الباري لكل خير.
[/INDENT]
وعليكم السلام ورحمة الله وبركاته ، و لماذا تنشىء نافذة جديدة ؟
عندك الحدث OnCloseQuery التابع للفورم الرئسي ضع فيه هذا الكود :
كود :
if messagedlg('Quitter le logiciel ? ',mtconfirmation,[mbYes,mbNo],0) = mrNo then
canclose := falseأي بمعنى انك تتحكم في قيمة canclose
وفقك الباري لكل خير.
[/INDENT]
01-04-2012, 06:42 PM
لا ليس بـــ messagedlg بلا بفورم
تم الحل
تم الحل
كود :
procedure Ttable.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
var
selected:integer;
begin
selected:= Form6.ShowModal;
if selected=mrOk then begin CanClose:=true;
end;
if selected=mrCancel then begin CanClose:=False;
end;
end;01-04-2012, 10:03 PM
Unit1
Unit2
كود :
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Unit2, StdCtrls;
type
TForm1 = class(TForm)
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
Actions: TCloseAction;
implementation
{$R *.dfm}
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Form2.ShowModal;
Action := Actions;
end;
end.كود :
unit Unit2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm2 = class(TForm)
Button1: TButton;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form2: TForm2;
implementation
{$R *.dfm}
uses Unit1;
procedure TForm2.Button1Click(Sender: TObject);
begin
Actions := caHide;
Close;
end;
procedure TForm2.Button2Click(Sender: TObject);
begin
Actions := caNone;
Close;
end;
end.