Doug,
How about using the wonderful Windows MessageBox? Here's how:
NOTE: You have to supply a HANDLE for the Message box. If you do not
supply a handle, it will become modeless and can be buried behind the users
view.. HANDLE is an undocumented value that is accessible with the
GETPROPERTY CompID HANDLE 'vHandleText' command. You need to convert the
text to INTEGER before passing it to the function.
The example shown here does NOT have an icon, but by changing the UINT
value, you can include the standard Windows Icons for the Message box.
You VB/VBA users will recognize the structure of the MessageBox as the
underlying control used by those languages.
In your forms OnBefore:
{ The declaration arguments are:
1 is an UINT (use RBase Integer) for the type of message box,
2 is the Caption of the message box,
3 is the Message to be displayed,
4 is the handle of the owner window (the current form or control}
}
IF (chkfunc('MessageBoxA')) = 0 THEN
STDCALL function 'MessageBoxA' alias 'MessageBox' +
(integer, ptr text (128), ptr text, integer ) : integer
ENDIF
In your controls EEP:
{Get the HANDLE of the owner window (form or control)}
SET VAR vthiswndtxt TEXT = NULL
GETPROPERTY RBASE_FORM HANDLE 'vThisWndtxt'
SET VAR vcallerhwnd = (INT(.vthiswndtxt))
SET VAR mb_yesnocancel = 3
SET VAR vretval INTEGER = 0
SET VAR vcaption TEXT = 'This is the Caption'
SET VAR vmsg TEXT = ('This is the Message first Line' + +
(CHAR(13)) + (CHAR(10)) + +
'Select Yes, No, or Cancel')
-- Type Caption Message OwnerWnd
-- function 'MessageBox' (integer, text (128), text, integer ) : integer
SET VAR vretval = (dlcall('user32.dll', 'MessageBoxA', mb_yesnocancel,
vcaption, vmsg, vcallerhwnd))
SWITCH (.vretval)
CASE 6
PAUSE 2 USING 'You Selected YES '
BREAK
CASE 7
PAUSE 2 USING 'You Selected NO '
BREAK
CASE 2
PAUSE 2 USING 'You Selected CANCEL '
BREAK
DEFAULT
PAUSE 2 USING 'You Selected CANCEL '
BREAK
ENDSW
RECALC VARIABLES
{ All of the constant values to make up the various incarnations of the
MessageBox can be found at Microsoft's MSDN Library, this URL:
<:http://msdn.microsoft.com/en-us/library/ms645505(VS.85).aspx>
}
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Doug
Hamilton
Sent: Monday, March 16, 2009 11:40 AM
To: RBASE-L Mailing List
Subject: [RBASE-L] - 3 Button Pause/Dialog?
Can Pause or Dialog boxes have three buttons?
Or should I build a quick mini-form w/ 3 buttons?
Situation:
User clicks exit button on a form after editing.
Pause/Dialog/whatever, pops up for confirmation:
___
Do you want to update the data?
Yes No Cancel
Yes - updates & exits
No - Exits without updating
Cancel - returns to the form for more editing
I could have two separate buttons on the form (Yes & No, Cancel is
unneeded), but you know user will click "Yes" which will instantaneously
illicit a "D'OH!". Confirmation-after-click is much preferred.
Or, ('cause it's Monday), what obvious solution am I not seeing?
TIA
Doug