![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Programmer
Join Date: Feb 2005
Posts: 47
Rep Power: 0
![]() |
Yes/ No Dialog
Hi, how do I make a basic yes/no dialog that comes up and confirms that I wanted to actually press the button I did?
Thanks. |
|
|
|
|
|
#2 |
|
Professional Programmer
Join Date: Sep 2005
Location: serbia & montenegro
Posts: 484
Rep Power: 4
![]() |
I don't know Delphi, but I belive that you need to show a MsgBox. Try to look at your documentation or maybe somebody here will show you the way.
|
|
|
|
|
|
#3 |
|
Hobbyist Programmer
Join Date: Oct 2005
Posts: 134
Rep Power: 4
![]() |
MessageBox function prototype:
function MessageBox(
hWnd: Cardinal;
lpText,
lpCaption: PChar;
uType: Cardinal
): Integer;lpText is the message you want displayed lpCaption is the title of box uType starts what type of box. Pass "MB_YESNO" (which equals 4) for a yes/no dialog box. BTW, I've never used Delphi in my life (behold the power of Google ) |
|
|
|
|
|
#4 |
|
Newbie
Join Date: Oct 2005
Posts: 3
Rep Power: 0
![]() |
Simply write the following:
if MessageDlg('Confirmation text', mtConfirmation, [mbYes, mbNo], 0) = mrYes then
begin
{...}
end; |
|
|
|
|
|
#5 |
|
Newbie
Join Date: Jan 2006
Posts: 3
Rep Power: 0
![]() |
if messagebox(application.handle, 'Press Y to Exit ? [Y or N]', pchar(form.caption), MB_YESNO)=IDYES then
exit; // application.terminate; |
|
|
|
|
|
#6 |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
Check out the ShowMessage function - it's a lot easier to use than MessageBox.
|
|
|
|
|
|
#7 | |
|
Hobbyist Programmer
Join Date: Dec 2005
Posts: 118
Rep Power: 0
![]() |
Quote:
On the other hand, if you don't want to press a button, why press it? :p |
|
|
|
|
|
|
#8 |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
So it does. OK, MessageDlg.
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|