• ¡Welcome to Square Theme!
  • This news are in header template.
  • Please ignore this message.
مهمان عزیز خوش‌آمدید. ورود عضــویت


امتیاز موضوع:
  • 12 رای - 3 میانگین
  • 1
  • 2
  • 3
  • 4
  • 5
Title: ساخت مسیج دیالوگ با دلفی (xe2)
حالت موضوعی
#1
سورس زیر برای Delphi xe2 میباشد که ساخت یک پنجره مسیج دیالوگ رو مانند تصویر زیر اموزش میدهد :



[عکس: PIC2012115149149332.jpg]

سورس کد :
کد:
Firemonkey has change how you work with MessageDlgs with values and some constants so I decided to show an example how to get you started. Attached below is the source code. You can find more firemonkey examples


کد:
unit MsgDlgs;

interface

uses
  System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
  FMX.Types, FMX.Controls, FMX.Forms, FMX.Dialogs;

type
  TMainForm = class(TForm)
    YesNoBN: TButton;
    OkCancelBN: TButton;
    YesNoCancelBN: TButton;
    AbortIgnoreBN: TButton;
    YesAllNoAllCancelBN: TButton;
    procedure YesNoBNClick(Sender: TObject);
    procedure AbortIgnoreBNClick(Sender: TObject);
    procedure OkCancelBNClick(Sender: TObject);
    procedure YesNoCancelBNClick(Sender: TObject);
    procedure YesAllNoAllCancelBNClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  MainForm: TMainForm;

implementation

{$R *.fmx}

{
  This example was coded by codecaine aka Jerome Scott II
  MessageDlgs have change since prior Delphi builds and will vets.
  I decided to show some examples of how they can be done in firemonkey
  I tested this on Mac OS X Lion as well as Windows 7. I hope you enjoy

  Here is a list of constants that can be used to to determine results and
  to create custom dialogs form sets which is found in System.UITypes.
  const
  idOK       = 1;
  idCancel   = 2;
  idAbort    = 3;
  idRetry    = 4;
  idIgnore   = 5;
  idYes      = 6;
  idNo       = 7;
  idClose    = 8;
  idHelp     = 9;
  idTryAgain = 10;
  idContinue = 11;
  mrNone     = 0;
  mrOk       = idOk;
  mrCancel   = idCancel;
  mrAbort    = idAbort;
  mrRetry    = idRetry;
  mrIgnore   = idIgnore;
  mrYes      = idYes;
  mrNo       = idNo;
  mrClose    = idClose;
  mrHelp     = idHelp;
  mrTryAgain = idTryAgain;
  mrContinue = idContinue;
  mrAll      = mrContinue + 1;
  mrNoToAll  = mrAll + 1;
  mrYesToAll = mrNoToAll + 1;
}

procedure TMainForm.YesNoBNClick(Sender: TObject);
begin
if MessageDlg('hello world',TMsgDlgType.mtConfirmation,mbYesNo,0) = IDYES then
  ShowMessage('Yes')
else
  ShowMessage('No');
end;

procedure TMainForm.OkCancelBNClick(Sender: TObject);
begin
if MessageDlg('hello world',TMsgDlgType.mtConfirmation,mbOkCancel,0) = IDABORT then
  ShowMessage('Ok')
else
  ShowMessage('Cancel');
end;

procedure TMainForm.YesNoCancelBNClick(Sender: TObject);
var
value : Integer;
begin
value := MessageDlg('hello world',TMsgDlgType.mtConfirmation,mbYesNoCancel,0);
case value of
IDYES:
  ShowMessage('Yes');
IDNO:
  ShowMessage('No');
IDCANCEL:
  ShowMessage('Cancel');
end;
end;

procedure TMainForm.AbortIgnoreBNClick(Sender: TObject);
begin
if MessageDlg('hello world',TMsgDlgType.mtConfirmation,mbAbortIgnore,0) = IDABORT then
  ShowMessage('Abort')
else
  ShowMessage('Ignore');
end;

procedure TMainForm.YesAllNoAllCancelBNClick(Sender: TObject);
var
value : Integer;
begin
value := MessageDlg('hello world',TMsgDlgType.mtConfirmation,mbYesAllNoAllCancel,0);
case value of
IDYES:
  ShowMessage('Yes');
IDNO:
  ShowMessage('No');
IDCANCEL:
  ShowMessage('Cancel');
mrAll + 1 :
  ShowMessage('No to all');
mrAll + 2:
  ShowMessage('Yes to all');
end;
end;

end.
گروه دور همی پارسی کدرز
https://t.me/joinchat/GxVRww3ykLynHFsdCvb7eg
 
پاسخ
  


موضوعات مشابه ...
موضوع نویسنده پاسخ بازدید آخرین ارسال
  سورس کد انتقال فایل به سطل اشغال ( دلفی) Amin_Mansouri 1 1,838 10-08-2022، 06:21 PM
آخرین ارسال: sonusood
  سورس بدست اوردن کلیپ برد ( دلفی ) Amin_Mansouri 1 1,939 10-08-2022، 05:49 PM
آخرین ارسال: sonusood
  دلفی و تلگرام h_mohamadi 2 2,640 04-24-2017، 12:14 AM
آخرین ارسال: shilanaseri
  رسم نمودار در اکسل از طریق دلفی Saeed7007 1 4,408 08-14-2014، 06:11 PM
آخرین ارسال: Amin_Mansouri
  سورس کد بدست اوردن اطلاعات هارد دیسک (دلفی) Amin_Mansouri 1 6,794 07-30-2014، 05:45 PM
آخرین ارسال: dehqan_mehdi
  ۳۵۰ سورس کد دلفی (دلفی رو از ابتدا تا حرفه ای شدن یاد بگیرید) Amin_Mansouri 11 26,962 01-31-2014، 04:27 PM
آخرین ارسال: Amin_Mansouri
  بارگذاری و یا نمایش تصویر فرمت jpg (دلفی) Amin_Mansouri 2 8,709 08-23-2013، 10:06 PM
آخرین ارسال: mo_coders
  بدست اوردن لیست درایورهای موجود بر روی سیستم توسط API (دلفی) Amin_Mansouri 0 3,606 08-17-2013، 09:56 AM
آخرین ارسال: Amin_Mansouri
  دانلود سورس کد استفاده از نقشه گوگل در دلفی Amin_Mansouri 0 5,447 08-17-2013، 09:44 AM
آخرین ارسال: Amin_Mansouri
  سورس کد شناسایی مرورگرهای نصب شده بر روی سیستم عامل (دلفی) Amin_Mansouri 0 3,767 08-17-2013، 09:35 AM
آخرین ارسال: Amin_Mansouri

پرش به انجمن:


Browsing: 1 مهمان