المشاركات : 30
المواضيع 17
:
: 0
الإنتساب : Feb 2012
السلام عليكم
كيف عند الضغط للخروج من البرنامج تطلب التاكييد ؟
كود :
http://www8.0zz0.com/2012/03/31/16/806116784.png
المشاركات : 48
المواضيع 14
:
: 1
الإنتساب : Nov 2011
وعليكم السلام
اولا لطلب التاكيد استعمل MessageDlg
PHP كود :
procedure TForm1.Button1Click(Sender: TObject);
begin
if MessageDlg('هل انت متاكد من رغبتك في الخروج',mtInformation,[mbYes,mbNo],0)=mryes then
Close;
end;
اما فيما يخص الامر الاخر وضح اكثر
اللهم علمنا ما ينفعنا و إنفعنا بما علمتنا
المشاركات : 1,252
المواضيع 170
:
: 1,500
الإنتساب : Jul 2009
[INDENT]
وعليكم السلام ورحمة الله وبركاته ، و لماذا تنشىء نافذة جديدة ؟
عندك الحدث OnCloseQuery التابع للفورم الرئسي ضع فيه هذا الكود :
كود :
if messagedlg('Quitter le logiciel ? ',mtconfirmation,[mbYes,mbNo],0) = mrNo then
canclose := false
أي بمعنى انك تتحكم في قيمة canclose
وفقك الباري لكل خير.
[/INDENT]
اللهم اجعلني من أهل القرآن ، الذين هم أهلك و خاصتك.
تذكر بأن الوقت الذي تلهو فيه ، غيرك يبني مجده فيه.
المشاركات : 30
المواضيع 17
:
: 0
الإنتساب : Feb 2012
لا ليس بـــ 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;
المشاركات : 654
المواضيع 34
:
: 106
الإنتساب : Aug 2010
Unit1
كود :
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.
Unit2
كود :
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.