Path: news.cs.au.dk!Morten.Grouleff.Mjolner.Informatics From: Morten Grouleff Newsgroups: comp.lang.beta Subject: Re: MB_YESNOCANCEL, MB_YESNO, MB_RETRYCANCEL ... Date: 01 Mar 1999 14:12:44 +0100 Organization: Mjolner Informatics. Lines: 98 Message-ID: References: <19990301093451.1650.qmail@noatun.mjolner.dk> NNTP-Posting-Host: hugin.mjolner.dk Mime-Version: 1.0 (generated by tm-edit 7.106) Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: xinwen.cs.au.dk 920293965 19829 255.255.255.255 (1 Mar 1999 13:12:45 GMT) X-Complaints-To: news@cs.au.dk NNTP-Posting-Date: 1 Mar 1999 13:12:45 GMT X-Newsreader: Gnus v5.5/Emacs 19.34 Xref: news.cs.au.dk comp.lang.beta:11852 "Sascha Kimmel" writes: > When I want to implement the WINAPI fucntions/Windows MB_YESNOCANCEL, > MB_YESNO, MB_RETRYCANCEL, MB_OKCANCEL, MB_ABORTRETRYIGNORE I have a problem. > I don't know where to implement the functions instead of inserting some code > into stddialogs_ntibody and stddialogs. > I want to use the "real" WINAPI functions/windows because then there are no > translations necessary and I don't have to do double work - if Microsoft has > already implemented these windows, why not call them? > > As you might already have guessed I also want to know which button was > clicked by the user. You don't have to insert the code in those files, as the fragment system allows you to insert the code in the right slots anyway. There is one small problem, though: The call of windows to show the messagebox does not save the returnvalue anywhere. I'll fix that, so that the following hack should not be necessary in upcoming releases. But for now, you will have to do somthing like: ORIGIN '~beta/guienv/v1.6/guienv'; INCLUDE '~beta/guienv/v1.6/stddialogs'; INCLUDE '~beta/guienv/v1.6/private/winnt/stddialogs_ntibody'; (* Start of hack due to missing save of returnvalue *) -- myGUIENVmessageDialogPrivate: descriptor -- (# type: @integer; mtitle: @text; msgCstr: @cString; result: @Integer; #) -- guienvLib: attributes -- MyMessageDialog: dialog (# message: ^text; messageDialogPrivate: @<>; onClose:< object; enter (message[], title[]) do inner; (if title[] = None then messageDialogPrivate.mtitle[] -> title[]; if); (if message[]=NONE then &text[] -> message[]; if); message[] -> messageDialogPrivate.msgCstr.set; (if messageDialogPrivate.msgCstr<>0 then (if owner[]=none then GetActiveWindow -> this(guienv).private.windows.findById -> owner[]; if); (if owner[]=none then (0,messageDialogPrivate.msgCstr,title,messageDialogPrivate.type) -> PrivMessageBox -> messageDialogPrivate.result; else (owner.interfaceObjectID,messageDialogPrivate.msgCstr,title, messageDialogPrivate.type) -> PrivMessageBox -> messageDialogPrivate.result; if); messageDialogPrivate.msgCstr.free; onClose; else (0,'Could not allocate msg. string.', 'Alert',messageDialogPrivate.type) -> MessageBox; if); #); (* End of hack due to missing save of returnvalue *) yesnoDialog: MyMessageDialog (# onClose:: (# do (if messageDialogPrivate.result=IDNO then onNo if); (if messageDialogPrivate.result=IDYES then onYes if); #); onNo:< object; onYes:< object; do inner; MB_ICONINFORMATION+MB_YESNO+MB_TASKMODAL+MB_SETFOREGROUND -> messageDialogPrivate.type; 'YES or NO' -> messageDialogPrivate.mtitle; #); --PROGRAM: descriptor-- guienv (# do (NONE, 'foo', 'bar') ->yesnoDialog (# onYes::(# do 'Yes selected'->screen.putLine #); onNo::(# do 'No selected'->screen.putLine #); #); terminate; #) Regards, -- ** Morten Grouleff: ** ** Earthworm Jim PC: ** ** Mjølner Informatics: **