Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Oct 27th, 2005, 4:57 PM   #1
gj15987
Programmer
 
Join Date: Feb 2005
Posts: 45
Rep Power: 0 gj15987 is on a distinguished road
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.
gj15987 is offline   Reply With Quote
Old Oct 27th, 2005, 5:00 PM   #2
ivan
Professional Programmer
 
ivan's Avatar
 
Join Date: Sep 2005
Location: serbia & montenegro
Posts: 484
Rep Power: 3 ivan is on a distinguished road
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.
ivan is offline   Reply With Quote
Old Oct 27th, 2005, 5:20 PM   #3
Kaja Fumei
Hobbyist Programmer
 
Join Date: Oct 2005
Posts: 134
Rep Power: 3 Kaja Fumei is on a distinguished road
MessageBox function prototype:
function MessageBox(
            hWnd: Cardinal; 
            lpText, 
            lpCaption: PChar; 
            uType: Cardinal
            ): Integer;
hWnd is the window that the box beloings to
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 )
Kaja Fumei is offline   Reply With Quote
Old Oct 28th, 2005, 8:40 AM   #4
ekamaloff
Newbie
 
Join Date: Oct 2005
Posts: 3
Rep Power: 0 ekamaloff is on a distinguished road
Simply write the following:

if MessageDlg('Confirmation text', mtConfirmation, [mbYes, mbNo], 0) = mrYes then
begin
    {...}
end;
ekamaloff is offline   Reply With Quote
Old Jan 4th, 2006, 4:54 PM   #5
chr15
Newbie
 
Join Date: Jan 2006
Posts: 3
Rep Power: 0 chr15 is on a distinguished road
if messagebox(application.handle, 'Press Y to Exit ? [Y or N]', pchar(form.caption), MB_YESNO)=IDYES then
exit; // application.terminate;
chr15 is offline   Reply With Quote
Old Jan 5th, 2006, 4:05 PM   #6
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
Check out the ShowMessage function - it's a lot easier to use than MessageBox.
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote
Old Jan 6th, 2006, 3:44 AM   #7
Klipt
Hobbyist Programmer
 
Join Date: Dec 2005
Posts: 118
Rep Power: 0 Klipt is an unknown quantity at this point
Quote:
Originally Posted by Ooble
Check out the ShowMessage function - it's a lot easier to use than MessageBox.
Although I don't think that gives a yes/no option.
On the other hand, if you don't want to press a button, why press it? :p
Klipt is offline   Reply With Quote
Old Jan 6th, 2006, 7:47 PM   #8
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
So it does. OK, MessageDlg.
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 12:50 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC