Elimde şöyle bir kod parçası var;
If MessageDlg('Hangi Tuşa Basıldı',mtinformation,[mbYes,mbNo,mbCancel],0);
Case a of
mrYes: showmessage('Yes Tuşuna Bastınız');
mrNo: showmessage('No Tuşuna Bastınız') else
showmessage('Cancel Tuşuna Bastınız');
end;//case
Bunu buttonClick olayına yazıcam. Sorum şu:
Burda a değişkenini ne şekilde tanımlamam gerekir, ve tipi ne olsun? Boolean olabilir mi?
Bilgisayar bölümünde okuyorum ve üç gün sonra Delphi'den vizem var. Yardımcı oluranız sevinirim....
MessageDlg'de Case of Kullanımı!
Forum kuralları
Forum kurallarını okuyup, uyunuz!
Forum kurallarını okuyup, uyunuz!
bu delphi helpten > MessageDlg yazınca çıkan sonuç > bu da istediğiniz bölüm. | Buttons: TMsgDlgButtons; >>>>function MessageDlg(const Msg: string; DlgType: TMsgDlgType; Buttons: TMsgDlgButtons; HelpCtx: Longint): Word;
Description
Call MessageDlg to bring up a message box and obtain the user's response. The message box displays the value of the Msg parameter. Use the DlgType parameter to indicate the purpose of the dialog. Use the Buttons parameter to indicate what buttons should appear in the message box. Use the HelpCtx parameter to specify the context ID for the help topic that should appear when the user clicks the help button or presses F1 while the dialog is displayed.
MessageDlg returns the value of the button the user selected. These are the possible return values:
Return values
mrNone mrAbort mrYes
mrOk mrRetry mrNo
mrCancel mrIgnore mrAll
diye umut ediyorum - KOLAY GELSİNTMsgDlgButtons defines a set of values used by MessageDlg and MessageDlgPos.
Unit
Dialogs
type
TMsgDlgBtn = (mbYes, mbNo, mbOK, mbCancel, mbAbort, mbRetry, mbIgnore, mbAll, mnNoToAll, mbYesToAll, mbHelp);
const
mbYesNoCancel = [mbYes, mbNo, mbCancel];
mbOKCancel = [mbOK, mbCancel];
mbAbortRetryIgnore = [mbAbort, mbRetry, mbIgnore];
TMsgDlgButtons = set of TMsgDlgBtn;
Description
The TMsgDlgButtons type defines the set of values a button in a message box can have. The TMsgDlgButtons type is used by the MessageDlg and MessageDlgPos functions. The following tables lists the possible values:
Value Meaning
mbYes A button with 'Yes' on its face.
mbNo A button the text 'No' on its face.
mbOK A button the text 'OK' on its face.
mbCancel A button with the text 'Cancel' on its face.
mbAbort A button with the text 'Abort' on its face
mbRetry A button with the text 'Retry' on its face
mbIgnore A button the text 'Ignore' on its face
mbAll A button with the text 'All' on its face
mbNoToAll A button with the text 'No to All' on its face
mbYesToAll A button with the text 'Yes to All' on its face
mbHelp A button with the text 'Help' on its face
In addition, the dialogs unit defines three constants for commonly used TMsgDlgButtons values:
Constant Meaning
mbYesNoCancel mbYes, mbNo, and mbCancel
mbOKCancel mbOK and mbCancel
mbAbortRetryIgnore mbAbort, mbRetry, and mbIgnore
Merhaba ,
şeklinde kullanmanızı öneririm, kod daha derli toplu durur.
iyi çalışmalar.
Kod: Tümünü seç
case MessageDlg('Hangi Tuşa Basıldı',mtinformation,[mbYes,mbNo,mbCancel],0) of
mrYes: showmessage('Yes Tuşuna Bastınız');
mrNo: showmessage('No Tuşuna Bastınız');
end;
iyi çalışmalar.
Volkan KAMADAN
www.polisoft.com.tr
www.polisoft.com.tr
Kod: Tümünü seç
procedure TForm1.Button1Click(Sender: TObject);
var
a: word;
begin
a := MessageDlg('Hangi Tuşa Basıldı',mtinformation,[mbYes,mbNo,mbCancel],0);
case a of
mryes : showmessage('yes basıldı');
mrno : showmessage('no basıldı')
//..
end;
//ya da a değişkenini hiç kullanma
case MessageDlg('Hangi Tuşa Basıldı',mtinformation,[mbYes,mbNo,mbCancel],0) of
mryes : showmessage('yes basıldı');
mrno : showmessage('no basıldı')
//..
end;
end;