Changed Application.Messagebox to use TMessageBox class.

Added icon images for mtError and mtConfirmation
Shane

git-svn-id: trunk@381 -
This commit is contained in:
lazarus 2001-11-01 18:48:52 +00:00
parent 0c36e4eab1
commit 0180f8302a
8 changed files with 205 additions and 88 deletions

View File

@ -1525,7 +1525,7 @@ try
AvailCompsComboBox.Items.AddObject(
ComponentToString(AComponent),AComponent);
except
Writeln('Exception: ObjectInspector AddComponentToAvailComboBox');
raise EGenException.Create('Exception: ObjectInspector AddComponentToAvailComboBox');
end;
end;
@ -1534,7 +1534,7 @@ begin
try
FillComponentComboBox;
except
Writeln('Exception: ObjectInspector PropEditLookupRootCHange');
raise EGenException.Create('Exception: ObjectInspector PropEditLookupRootCHange');
end;
end;
@ -1570,7 +1570,7 @@ try
end else
AvailCompsComboBox.ItemIndex:=a;
except
Writeln('Exception: ObjectInspector FillComponentComboBox');
raise EGenException.Create('Exception: ObjectInspector FillComponentComboBox');
end;
end;

View File

@ -697,8 +697,7 @@ writeln('[TMainIDE.FormCloseQuery]');
CanClose:=true;
if SomethingOfProjectIsModified then begin
if (MessageDlg('Project changed', 'Save changes to project?',
mtconfirmation, [mbOK, mbcancel], 0))=mrOK then
if (Application.MessageBox('Save changes to project?','Project changed', MB_IconQuestion+mb_YesNo))=mrYes then
begin
CanClose:=DoSaveProject(false,false)<>mrAbort;
if CanClose=false then exit;
@ -1186,9 +1185,7 @@ end;
Procedure TMainIDE.SetDesigning(Control : TComponent; Value : Boolean);
Begin
Writeln('Setting designing');
Control.SetDesigning(Value);
Writeln('Set');
end;
@ -3562,7 +3559,7 @@ begin
except
ACaption:='Read Error';
AText:='Unable to read file "'+AFilename+'"!';
Result:=MessageDlg(ACaption, AText,mterror, [mbabort, mbretry, mbignore], 0);
result := Application.MessageBox(PChar(aText),pChar(aCaption),mb_IconError+mb_AbortRetryIgnore);
if Result=mrAbort then exit;
end;
until Result<>mrRetry;
@ -4370,6 +4367,11 @@ end.
{ =============================================================================
$Log$
Revision 1.131 2001/11/01 18:48:48 lazarus
Changed Application.Messagebox to use TMessageBox class.
Added icon images for mtError and mtConfirmation
Shane
Revision 1.130 2001/10/31 18:09:51 lazarus
MG: fixed DirectoryExists
@ -8985,6 +8987,11 @@ end.
{ =============================================================================
$Log$
Revision 1.131 2001/11/01 18:48:48 lazarus
Changed Application.Messagebox to use TMessageBox class.
Added icon images for mtError and mtConfirmation
Shane
Revision 1.130 2001/10/31 18:09:51 lazarus
MG: fixed DirectoryExists

View File

@ -2365,9 +2365,13 @@ End;
Procedure TSourceNotebook.FindInFilesClicked(Sender : TObject);
Begin
MessageDlg('Not implemented yet',
Application.MessageBox('If You can help us implement this feature, mail to'#13
+'lazarus@miraclec.com','Not implemented yet',mb_IconInformation+mb_OK);
{ MessageDlg('Not implemented yet',
'If you can help us to implement this feature, mail to'#13
+'lazarus@miraclec.com', mtInformation,[mbCancel],0);
+'lazarus@miraclec.com', mtInformation,[mbCancel],0);
}
End;
Procedure TSourceNotebook.BookMarkClicked(Sender : TObject);

View File

@ -167,7 +167,7 @@ const
mrNoToAll, mrYesToAll, 0);
type
PCharArray32x32 = Array [0..35] of PChar;
PCharArray32x32 = Array [0..36] of PChar;
var
mtImages : Array [TMsgDlgType] of PCharArray32x32;
@ -198,7 +198,7 @@ begin
mtImages [MtWarning ] := IMGWarning;
mtImages [MtError ] := IMGError;
mtImages [MtInformation ] := IMGInfo;
mtImages [MtConfirmation] := IMGInfo;
mtImages [MtConfirmation] := IMGConfirmation;
mtImages [MtCustom ] := IMGInfo;
end;
@ -213,6 +213,11 @@ end.
{ =============================================================================
$Log$
Revision 1.8 2001/11/01 18:48:51 lazarus
Changed Application.Messagebox to use TMessageBox class.
Added icon images for mtError and mtConfirmation
Shane
Revision 1.7 2001/07/31 18:40:24 lazarus
MG: added unit info, arrow xpms, and many changes from jens arm

View File

@ -255,6 +255,7 @@ type
procedure Idle;
procedure MouseIdle(const CurrentControl: TControl);
procedure SetIcon(AValue: TIcon);
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
@ -313,7 +314,7 @@ implementation
uses
Buttons, StdCtrls, Interfaces, LResources {,designer};
Buttons, StdCtrls, Interfaces, LResources, dialogs {,designer};
const
FocusMessages : Boolean = true;
@ -323,9 +324,10 @@ procedure ExceptionOccurred(Sender : TObject; Addr,Frame : Pointer);
var
Mess : String;
Begin
Mess := 'Error occurred at '#13#10'Address '+HexStr(Cardinal(Addr),8);
Writeln('[FORMS.PP] ExceptionOccurred Procedure');
Mess := 'Error occurred in '+Sender.ClassName+' at '#13#10'Address '+HexStr(Cardinal(Addr),8)+#13#10'Frame '+HexStr(Cardinal(Frame),8);
if Application<>nil then
Application.MessageBox('Exception',PChar(Mess),mb_IconError+mb_Ok)
Application.MessageBox(PChar(Mess),'Exception',mb_IconError+mb_Ok)
else
writeln(Mess);
end;

View File

@ -51,8 +51,49 @@ end;
{ TApplication Messagebox }
{------------------------------------------------------------------------------}
function TApplication.MessageBox(Text, Caption : PChar; Flags : Longint) : Integer;
var
DlgType : TMsgDlgType;
Buttons : TMsgDlgButtons;
begin
Result:= LCLLinux.MessageBox(Handle, Text, Caption, Flags);
//This uses TMessageBox class in MessageDialogs.inc
if (Flags and MB_OK) = MB_OK then
Buttons := [mbOK]
else
if (Flags and MB_OKCANCEL) = MB_OKCANCEL then
Buttons := [mbOK,mbCancel]
else
if (Flags and MB_ABORTRETRYIGNORE) = MB_ABORTRETRYIGNORE then
Buttons := [mbAbort, mbRetry, mbIgnore]
else
if (Flags and MB_YESNOCANCEL) = MB_YESNOCANCEL then
Buttons := [mbYes, mbNO, mbCAncel]
else
if (Flags and MB_YESNO) = MB_YESNO then
Buttons := [mbYes, mbNo]
else
if (Flags and MB_RETRYCANCEL) = MB_RETRYCANCEL then
Buttons := [mbREtry, mbCancel]
else
Buttons := [mbOK];
if (Flags and MB_ICONWARNING) = MB_ICONWARNING then
DlgTYpe := mtWarning
else
if (Flags and MB_ICONERROR) = MB_ICONERROR then
DlgTYpe := mtError
else
if (Flags and MB_ICONINFORMATION) = MB_ICONINFORMATION then
DlgTYpe := mtInformation
else
if (Flags and MB_ICONQUESTION) = MB_ICONQUESTION then
DlgTYpe := mtConfirmation
else
DlgTYpe := mtCustom;
Result := MessageDlg(Caption,Text,DlgType,Buttons,0);
end;
{------------------------------------------------------------------------------}
@ -302,6 +343,11 @@ end;
{ =============================================================================
$Log$
Revision 1.11 2001/11/01 18:48:52 lazarus
Changed Application.Messagebox to use TMessageBox class.
Added icon images for mtError and mtConfirmation
Shane
Revision 1.10 2001/10/31 22:12:12 lazarus
MG: added ExceptProc to forms.pp

View File

@ -3,8 +3,9 @@ const
IMGInfo : PCharArray32x32 =
(
'32 32 3 1',
'32 32 4 1',
'. c None',
' c None',
'a c #ffffff', //#c3c3c3',
'# c #0000ff',
'............#######.............',
@ -42,78 +43,119 @@ IMGInfo : PCharArray32x32 =
IMGWarning : PCharArray32x32 =
(
'32 32 3 1',
' c None',
'. c #FFFFFFFF0000',
'32 32 4 1',
'# c #000000',
' ....... ',
' ............. ',
' ................. ',
' .....#########..... ',
' ......#########...... ',
' .......#########....... ',
' .........#######......... ',
' ..........#######.......... ',
' ..........#######.......... ',
' ...........#######........... ',
' ............#####............ ',
' ............#####............ ',
'.............#####............. ',
'.............#####............. ',
'.............#####............. ',
'..............###.............. ',
'..............###.............. ',
'..............###.............. ',
'............................... ',
' ............................. ',
' .............###............. ',
' ............#####............ ',
' ...........#####........... ',
' ...........#####........... ',
' ...........###........... ',
' ....................... ',
' ..................... ',
' ................... ',
' ................. ',
' ............. ',
' ....... ',
' ');
'b c #9c999c',
'. c None',
'a c #ffff00',
'.............###................',
'............#aaa#...............',
'...........#aaaaa#b.............',
'...........#aaaaa#bb............',
'..........#aaaaaaa#bb...........',
'..........#aaaaaaa#bb...........',
'.........#aaaaaaaaa#bb..........',
'.........#aaaaaaaaa#bb..........',
'........#aaaaaaaaaaa#bb.........',
'........#aaaa###aaaa#bb.........',
'.......#aaaa#####aaaa#bb........',
'.......#aaaa#####aaaa#bb........',
'......#aaaaa#####aaaaa#bb.......',
'......#aaaaa#####aaaaa#bb.......',
'.....#aaaaaa#####aaaaaa#bb......',
'.....#aaaaaa#####aaaaaa#bb......',
'....#aaaaaaaa###aaaaaaaa#bb.....',
'....#aaaaaaaa###aaaaaaaa#bb.....',
'...#aaaaaaaaa###aaaaaaaaa#bb....',
'...#aaaaaaaaaa#aaaaaaaaaa#bb....',
'..#aaaaaaaaaaa#aaaaaaaaaaa#bb...',
'..#aaaaaaaaaaaaaaaaaaaaaaa#bb...',
'.#aaaaaaaaaaaa##aaaaaaaaaaa#bb..',
'.#aaaaaaaaaaa####aaaaaaaaaa#bb..',
'#aaaaaaaaaaaa####aaaaaaaaaaa#bb.',
'#aaaaaaaaaaaaa##aaaaaaaaaaaa#bb.',
'#aaaaaaaaaaaaaaaaaaaaaaaaaaa#bbb',
'#aaaaaaaaaaaaaaaaaaaaaaaaaaa#bbb',
'.#aaaaaaaaaaaaaaaaaaaaaaaaa#bbbb',
'..#########################bbbbb',
'....bbbbbbbbbbbbbbbbbbbbbbbbbbb.',
'.....bbbbbbbbbbbbbbbbbbbbbbbbb..');
IMGError : PCharArray32x32 =
(
'32 32 3 1',
' c None',
'. c #FFFF00000000',
'32 32 4 1',
'. c None',
'b c #808080',
'# c #c00000',
'a c #ffffff',
'................................',
'................................',
'................................',
'............#######.............',
'...........###########..........',
'........###############.........',
'.......##################.......',
'......####################......',
'.....###aa############aa###.....',
'.....###aaa##########aaa###.....',
'....#####aaa########aaa#####....',
'....######aaa######aaa######....',
'...########aaa####aaa########...',
'...#########aaa##aaa#########b..',
'...##########aaaaaa##########b..',
'...###########aaaa###########b..',
'...###########aaaa###########b..',
'...##########aaaaaa##########b..',
'...#########aaa##aaa#########b..',
'...########aaa####aaa#######bb..',
'....######aaa######aaa######bb..',
'.....####aaa########aaa#####bb..',
'.....###aaa##########aaa###bbb..',
'.....###aa############aa##bbb...',
'......####################bb....',
'.......##################bb.....',
'.........###############bb......',
'..........###########bbbb.......',
'.............#######bbb.........',
'................................',
'................................',
'................................');
IMGConfirmation : PCharArray32x32 =
(
'32 32 4 1',
'. c None',
'b c #808080',
'a c #c00000',
'# c #ffffff',
' ....... ',
' ............. ',
' ................. ',
' .....#########..... ',
' ......#########...... ',
' .......#########....... ',
' .........#######......... ',
' ..........#######.......... ',
' ..........#######.......... ',
' ...........#######........... ',
' ............#####............ ',
' ............#####............ ',
'.............#####............. ',
'.............#####............. ',
'.............#####............. ',
'..............###.............. ',
'..............###.............. ',
'..............###.............. ',
'............................... ',
' ............................. ',
' .............###............. ',
' ............#####............ ',
' ...........#####........... ',
' ...........#####........... ',
' ...........###........... ',
' ....................... ',
' ..................... ',
' ................... ',
' ................. ',
' ............. ',
' ....... ',
' ');
'................................',
'................................',
'................................',
'................................',
'.............######.............',
'..........###########...........',
'.........##############.........',
'........################........',
'.......##################.......',
'......########aaaaa#######......',
'.....########aaaaaaa#######.....',
'.....#######aa#####aa######.....',
'.....#######a######aa#######....',
'....###############aa#######b...',
'....###############aa#######bb..',
'....##############aa########bb..',
'....#############aa#########bb..',
'....############aa##########bb..',
'....###########aa###########bb..',
'.....##########aa##########bbb..',
'.....##########aa##########bbb..',
'.....##########aa##########bb...',
'......#########aa#########bb....',
'.......##################bbb....',
'........#######aa#######bbb.....',
'.........######aa######bbb......',
'...........###########bbb.......',
'.............######bbbbb........',
'................................',
'................................',
'................................',
'................................');

View File

@ -414,7 +414,13 @@ MB_ABORTRETRYIGNORE = $00000002;
MB_YESNOCANCEL = $00000003;
MB_YESNO = $00000004;
MB_RETRYCANCEL = $00000005;
MB_ICONERROR = $00000010;
MB_ICONHAND = $00000010;
MB_ICONQUESTION = $00000020;
MB_ICONEXCLAMATION = $00000030;
MB_ICONASTERICK = $00000040;
MB_ICONWARNING = MB_ICONEXCLAMATION;
MB_ICONERROR = MB_ICONHAND;
MB_ICONINFORMATION = MB_ICONASTERICK;
IDOK = 1; ID_OK = IDOK;
IDCANCEL = 2; ID_CANCEL = IDCANCEL;
@ -1388,6 +1394,11 @@ end.
{
$Log$
Revision 1.12 2001/11/01 18:48:52 lazarus
Changed Application.Messagebox to use TMessageBox class.
Added icon images for mtError and mtConfirmation
Shane
Revision 1.11 2001/10/31 21:43:28 lazarus
Added code for TApplication to get it ready to accept exceptions.
Shane