mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-01 21:40:25 +02:00
LCL: fpgui: implements the Windows API function MessageBox(), issue #22865
git-svn-id: trunk@38627 -
This commit is contained in:
parent
68fe7a297a
commit
a494c8a157
@ -86,7 +86,7 @@ const
|
|||||||
idButtonClose);
|
idButtonClose);
|
||||||
|
|
||||||
DialogResults : Array[idButtonOK..idButtonNoToAll] of TModalResult = (
|
DialogResults : Array[idButtonOK..idButtonNoToAll] of TModalResult = (
|
||||||
mrOk, mrCancel,
|
mrOk, mrCancel,
|
||||||
mrNone{Help - when a mbHelp button is pressed the help system is started,
|
mrNone{Help - when a mbHelp button is pressed the help system is started,
|
||||||
the dialog does not close },
|
the dialog does not close },
|
||||||
mrYes, mrNo, mrClose, mrAbort, mrRetry,
|
mrYes, mrNo, mrClose, mrAbort, mrRetry,
|
||||||
|
@ -469,6 +469,65 @@ begin
|
|||||||
Result:=true;
|
Result:=true;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{ Most of the functionality is implemented. As described in MSDN:
|
||||||
|
http://msdn.microsoft.com/en-us/library/windows/desktop/ms645505%28v=vs.85%29.aspx }
|
||||||
|
function TFpGuiWidgetSet.MessageBox(hWnd: HWND; lpText, lpCaption: PChar;
|
||||||
|
uType: Cardinal): integer;
|
||||||
|
var
|
||||||
|
Str: AnsiString;
|
||||||
|
TitleStr: AnsiString;
|
||||||
|
Buttons : TfpgMsgDlgButtons;
|
||||||
|
BtnType: Cardinal;
|
||||||
|
DlgType: Cardinal;
|
||||||
|
begin
|
||||||
|
BtnType := (uType and $0000000F); { mask the button type }
|
||||||
|
|
||||||
|
if (BtnType = MB_OKCANCEL) then
|
||||||
|
Buttons := mbOKCancel
|
||||||
|
else
|
||||||
|
if (BtnType = MB_ABORTRETRYIGNORE) then
|
||||||
|
Buttons := mbAbortRetryIgnore
|
||||||
|
else
|
||||||
|
if (BtnType = MB_YESNOCANCEL) then
|
||||||
|
Buttons := mbYesNoCancel
|
||||||
|
else
|
||||||
|
if (BtnType = MB_YESNO) then
|
||||||
|
Buttons := mbYesNo
|
||||||
|
else
|
||||||
|
if (BtnType = MB_RETRYCANCEL) then
|
||||||
|
Buttons := [mbRetry, mbCancel]
|
||||||
|
else
|
||||||
|
if (BtnType = MB_CANCELTRYCONTINUE) then
|
||||||
|
Buttons := mbAbortRetryIgnore
|
||||||
|
else
|
||||||
|
Buttons := [mbOK];
|
||||||
|
|
||||||
|
{ shoud we had a Help button too? - again as per MSDN }
|
||||||
|
if (uType and MB_HELP) = MB_HELP then
|
||||||
|
Include(Buttons, mbHelp);
|
||||||
|
|
||||||
|
Str := lpText;
|
||||||
|
TitleStr := lpCaption;
|
||||||
|
if lpCaption = nil then
|
||||||
|
TitleStr := 'Error'; // as per MSDN
|
||||||
|
|
||||||
|
DlgType := (uType and $000000F0); { mask the dialog type }
|
||||||
|
|
||||||
|
if (DlgType and MB_ICONINFORMATION) = MB_ICONINFORMATION then
|
||||||
|
TfpgMessageDialog.Information(TitleStr, Str, Buttons)
|
||||||
|
else
|
||||||
|
if (DlgType and MB_ICONWARNING) = MB_ICONWARNING then
|
||||||
|
TfpgMessageDialog.Warning(TitleStr, Str, Buttons)
|
||||||
|
else
|
||||||
|
if (DlgType and MB_ICONQUESTION) = MB_ICONQUESTION then
|
||||||
|
TfpgMessageDialog.Question(TitleStr, Str, Buttons)
|
||||||
|
else
|
||||||
|
if (DlgType and MB_ICONERROR) = MB_ICONERROR then
|
||||||
|
TfpgMessageDialog.Critical(TitleStr, Str, Buttons)
|
||||||
|
else
|
||||||
|
TfpgMessageDialog.Information(TitleStr, Str, Buttons);
|
||||||
|
end;
|
||||||
|
|
||||||
function TFpGuiWidgetSet.Rectangle(DC: HDC; X1, Y1, X2, Y2: Integer): Boolean;
|
function TFpGuiWidgetSet.Rectangle(DC: HDC; X1, Y1, X2, Y2: Integer): Boolean;
|
||||||
var
|
var
|
||||||
ADC: TFpGuiDeviceContext absolute DC;
|
ADC: TFpGuiDeviceContext absolute DC;
|
||||||
|
@ -138,8 +138,9 @@ function IsWindowVisible(Handle: HWND): boolean; override;
|
|||||||
|
|
||||||
procedure LeaveCriticalSection(var CritSection: TCriticalSection); override;
|
procedure LeaveCriticalSection(var CritSection: TCriticalSection); override;
|
||||||
function LineTo(DC: HDC; X, Y: Integer): Boolean; override;
|
function LineTo(DC: HDC; X, Y: Integer): Boolean; override;
|
||||||
|
}
|
||||||
function MessageBox(hWnd: HWND; lpText, lpCaption: PChar; uType: Cardinal): integer; override;
|
function MessageBox(hWnd: HWND; lpText, lpCaption: PChar; uType: Cardinal): integer; override;
|
||||||
|
{
|
||||||
function MoveToEx(DC: HDC; X, Y: Integer; OldPoint: PPoint): Boolean; override;
|
function MoveToEx(DC: HDC; X, Y: Integer; OldPoint: PPoint): Boolean; override;
|
||||||
|
|
||||||
function PeekMessage(var lpMsg : TMsg; Handle : HWND; wMsgFilterMin, wMsgFilterMax,wRemoveMsg : UINT): Boolean; override;
|
function PeekMessage(var lpMsg : TMsg; Handle : HWND; wMsgFilterMin, wMsgFilterMax,wRemoveMsg : UINT): Boolean; override;
|
||||||
|
Loading…
Reference in New Issue
Block a user