Intermediate UI patch to show a bug.

git-svn-id: trunk@3279 -
This commit is contained in:
lazarus 2002-09-03 20:02:01 +00:00
parent da2e467433
commit 939e1f6074
5 changed files with 38 additions and 23 deletions

View File

@ -70,9 +70,10 @@ end;
procedure TMainForm.Button1Click(Sender : TObject); procedure TMainForm.Button1Click(Sender : TObject);
begin begin
ShowMessage ('First simple test!'); ShowMessage ('First simple test!');
writeln('Go to second dialog');
MessageDlg ('Caption', 'Two buttons now...', mtError, [mbOK,mbCancel], 0); MessageDlg ('Caption', 'Two buttons now...', mtError, [mbOK,mbCancel], 0);
MessageDlg ('Warning, not fully implemented', mtWarning, [mbYes, mbNo, mbOK,mbCancel], 0); MessageDlg ('Warning, not fully implemented', mtWarning, [mbYes, mbNo, mbOK,mbCancel], 0);
ShowMessageFmt ('The show will end now'+#13+'%s'+#13+'Good bye!!!', [MainForm.Caption]); ShowMessageFmt ('The show will end now'+LineEnding+'%s'+LineEnding+'Good bye!!!', [MainForm.Caption]);
close; close;
end; end;
@ -84,6 +85,9 @@ begin
end. end.
{ {
$Log$ $Log$
Revision 1.5 2002/09/03 20:02:01 lazarus
Intermediate UI patch to show a bug.
Revision 1.4 2002/08/30 10:06:07 lazarus Revision 1.4 2002/08/30 10:06:07 lazarus
Fixed alignment of multiline TLabel. Fixed alignment of multiline TLabel.
Simplified and prettified MessageBoxen. Simplified and prettified MessageBoxen.

View File

@ -194,7 +194,7 @@ ResourceString
lisSelectDFMFiles = 'Select Delphi form files (*.dfm)'; lisSelectDFMFiles = 'Select Delphi form files (*.dfm)';
// dialogs // dialogs
lisSaveChangesToProject = 'Save changes to project?'; lisSaveChangesToProject = 'Save changes to project %s?';
lisProjectChanged = 'Project changed'; lisProjectChanged = 'Project changed';
lisFPCSourceDirectoryError = 'FPC Source Directory error'; lisFPCSourceDirectoryError = 'FPC Source Directory error';

View File

@ -964,7 +964,7 @@ Function TCustomForm.ShowModal : Integer;
SaveCount: Integer; SaveCount: Integer;
ActiveWindow: HWnd;} ActiveWindow: HWnd;}
begin begin
//writeln('[TCustomForm.ShowModal] START ',Classname); //writeln('[TCustomForm.ShowModal] START ',Classname);
if Visible or not Enabled or (fsModal in FFormState) or if Visible or not Enabled or (fsModal in FFormState) or
(FormStyle = fsMDIChild) then (FormStyle = fsMDIChild) then
raise EInvalidOperation.Create('TCustomForm.ShowModal impossible'); raise EInvalidOperation.Create('TCustomForm.ShowModal impossible');
@ -983,11 +983,12 @@ begin
SaveCount := Screen.FCursorCount; SaveCount := Screen.FCursorCount;
WindowList := DisableTaskWindows(0);} WindowList := DisableTaskWindows(0);}
ModalResult := 0; ModalResult := 0;
try try
Show; Show;
try try
CNSendMessage(LM_SHOWMODAL, Self, nil); CNSendMessage(LM_SHOWMODAL, Self, nil);
Repeat repeat
{ Delphi calls Application.HandleMessage { Delphi calls Application.HandleMessage
But HandleMessage processes all pending events and then calls idle, But HandleMessage processes all pending events and then calls idle,
which will wait for new messages. Under Win32 there always a next which will wait for new messages. Under Win32 there always a next
@ -1001,6 +1002,7 @@ begin
if ModalResult<>0 then break; if ModalResult<>0 then break;
Application.Idle; Application.Idle;
until ModalResult <> 0; until ModalResult <> 0;
Result := ModalResult; Result := ModalResult;
//if GetActiveWindow <> Handle then ActiveWindow := 0; //if GetActiveWindow <> Handle then ActiveWindow := 0;
finally finally
@ -1025,7 +1027,11 @@ end;
{ ============================================================================= { =============================================================================
$Log$ $Log$
Revision 1.56 2002/09/03 20:02:01 lazarus
Intermediate UI patch to show a bug.
Revision 1.55 2002/09/03 11:32:49 lazarus Revision 1.55 2002/09/03 11:32:49 lazarus
Added shortcut keys to labels Added shortcut keys to labels
Support for alphabetically sorting the properties Support for alphabetically sorting the properties
Standardize message and add shortcuts ala Kylix Standardize message and add shortcuts ala Kylix

View File

@ -106,7 +106,7 @@ procedure TCustomLabel.SetShowAccelChar(Val : boolean);
begin begin
if Val <> FShowAccelChar then begin if Val <> FShowAccelChar then begin
FShowAccelChar:= Val; FShowAccelChar:= Val;
CNSendMessage(LM_SETLABEL, Self, PChar(Caption)); if HandleAllocated then CNSendMessage(LM_SETLABEL, Self, PChar(Caption));
end; end;
end; end;
@ -144,7 +144,11 @@ end;
{ ============================================================================= { =============================================================================
$Log$ $Log$
Revision 1.6 2002/09/03 20:02:01 lazarus
Intermediate UI patch to show a bug.
Revision 1.5 2002/09/03 11:32:49 lazarus Revision 1.5 2002/09/03 11:32:49 lazarus
Added shortcut keys to labels Added shortcut keys to labels
Support for alphabetically sorting the properties Support for alphabetically sorting the properties
Standardize message and add shortcuts ala Kylix Standardize message and add shortcuts ala Kylix

View File

@ -94,6 +94,7 @@ begin
FMsgLines := TStringList.Create; FMsgLines := TStringList.Create;
FLabel := TLabel.Create(Self); FLabel := TLabel.Create(Self);
FLabel.Alignment:= taLeftJustify; FLabel.Alignment:= taLeftJustify;
FLabel.ShowAccelChar:= false;
FLabel.Parent:= Self; FLabel.Parent:= Self;
FLabel.Visible:= true; FLabel.Visible:= true;
@ -168,9 +169,9 @@ end;
function TMessageBox.LineWidth(Index: integer): integer; function TMessageBox.LineWidth(Index: integer): integer;
begin begin
if (Index>=0) and (Index<FMsgLines.Count) then if (Index>=0) and (Index<FMsgLines.Count) then
Result:=Canvas.TextWidth(FMsgLines[Index]) Result:= Canvas.TextWidth(FMsgLines[Index])
else else
Result:=0; Result:= 0;
end; end;
{------------------------------------------------------------------------------ {------------------------------------------------------------------------------
@ -244,8 +245,7 @@ begin
FDlgType := value; FDlgType := value;
FBitmap.Free; FBitmap.Free;
FBitmap := TBitmap.Create; FBitmap := TBitmap.Create;
FBitmap.Handle := CreatePixmapIndirect(@mtImages[FDlgType], FBitmap.Handle := CreatePixmapIndirect(@mtImages[FDlgType], ColorToRGB(clBtnFace));
ColorToRGB(clBtnFace));
if DefaultCaption then if DefaultCaption then
Caption := cMtCaption[FDlgType]; Caption := cMtCaption[FDlgType];
end; end;
@ -279,7 +279,6 @@ const
cBtnDist = cBtnWidth + 4; cBtnDist = cBtnWidth + 4;
cMinLeft = cBitmapX + cBitmapWidth + cLabelSpacing; cMinLeft = cBitmapX + cBitmapWidth + cLabelSpacing;
var var
aButton : TBitBtn; // temp. variable to create buttons
aBitmap : TBitmap; // temp. variable to create bitmaps for buttons aBitmap : TBitmap; // temp. variable to create bitmaps for buttons
curBtn : TMsgDlgBtn; // variable to loop through TMsgDlgButtons curBtn : TMsgDlgBtn; // variable to loop through TMsgDlgButtons
ButtonLeft : integer; // left position of button(s) ButtonLeft : integer; // left position of button(s)
@ -291,11 +290,11 @@ var
i, j : integer; i, j : integer;
ButtonIndex : integer; ButtonIndex : integer;
begin begin
if FUpdateCounter>0 then exit; if FUpdateCounter > 0 then exit;
// calculate label width // calculate label width
LabelWidth:= 0; LabelWidth:= 0;
for i:=0 to FMsgLines.Count-1 do begin for i:=0 to FMsgLines.Count - 1 do begin
j:=LineWidth(i); j:=LineWidth(i);
if j > LabelWidth then LabelWidth:= j; if j > LabelWidth then LabelWidth:= j;
end; end;
@ -329,15 +328,15 @@ begin
// set up labels // set up labels
FLabel.SetBounds(LabelLeft, cLabelSpacing, LabelWidth, LabelHeight); FLabel.SetBounds(LabelLeft, cLabelSpacing, LabelWidth, LabelHeight);
Flabel.Caption:= Trim(FMsgLines.Text); Flabel.Caption:= Trim(FMsgLines.Text);
// create the buttons // create the buttons
ButtonIndex := -1; ButtonIndex := -1;
for curBtn := low(TMsgDlgBtn) to high(TMsgDlgBtn) do begin for curBtn := low(TMsgDlgBtn) to high(TMsgDlgBtn) do begin
if curBtn in FButtons then begin if curBtn in FButtons then begin
inc(ButtonIndex); inc(ButtonIndex);
aButton := TBitBtn.Create(self);
With aButton do begin with TBitBtn.Create(Self) do begin
Parent := Self; Parent:= Self;
SetBounds (ButtonLeft, 2 * cLabelSpacing + reqHeight, cBtnWidth, cBtnHeight); SetBounds (ButtonLeft, 2 * cLabelSpacing + reqHeight, cBtnWidth, cBtnHeight);
inc(ButtonLeft, cBtnDist); inc(ButtonLeft, cBtnDist);
Layout := blGlyphLeft; Layout := blGlyphLeft;
@ -373,9 +372,8 @@ end;
procedure TMessageBox.EndUpdate; procedure TMessageBox.EndUpdate;
begin begin
dec(FUpdateCounter); dec(FUpdateCounter);
if FUpdateCounter<0 then FUpdateCounter:=0; if FUpdateCounter<0 then FUpdateCounter:= 0;
if (FUpdateCounter=0) and (FRelayoutNeeded) then if (FUpdateCounter = 0) and FRelayoutNeeded then ReLayout;
ReLayout;
end; end;
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
@ -385,13 +383,13 @@ function CreateMessageDialog(const aMsg: string; DlgType: TMsgDlgType;
var var
msgbox : TMessageBox; msgbox : TMessageBox;
begin begin
msgbox := TMessageBox.Create (application); msgbox:= TMessageBox.Create(Application);
msgbox.BeginUpdate; msgbox.BeginUpdate;
msgbox.theMessage := aMsg; msgbox.theMessage := aMsg;
msgBox.DialogType := DlgType; msgBox.DialogType := DlgType;
msgBox.Buttons := buttons; msgBox.Buttons := buttons;
msgbox.EndUpdate; msgbox.EndUpdate;
Result := msgbox; Result:= msgbox;
end; end;
function CreateMessageDialogWithCap(const aCaption, aMsg: string; function CreateMessageDialogWithCap(const aCaption, aMsg: string;
@ -399,14 +397,14 @@ function CreateMessageDialogWithCap(const aCaption, aMsg: string;
var var
msgbox : TMessageBox; msgbox : TMessageBox;
begin begin
msgbox := TMessageBox.Create (Application); msgbox:= TMessageBox.Create(Application);
msgbox.BeginUpdate; msgbox.BeginUpdate;
msgbox.theMessage := aMsg; msgbox.theMessage := aMsg;
msgBox.DialogType := DlgType; msgBox.DialogType := DlgType;
msgBox.Buttons := buttons; msgBox.Buttons := buttons;
msgBox.Caption := aCaption; msgBox.Caption := aCaption;
msgbox.EndUpdate; msgbox.EndUpdate;
Result := msgbox; Result:= msgbox;
end; end;
function MessageDlg(const aMsg: string; DlgType: TMsgDlgType; function MessageDlg(const aMsg: string; DlgType: TMsgDlgType;
@ -474,6 +472,9 @@ end;
{ {
$Log$ $Log$
Revision 1.13 2002/09/03 20:02:01 lazarus
Intermediate UI patch to show a bug.
Revision 1.12 2002/08/30 10:06:07 lazarus Revision 1.12 2002/08/30 10:06:07 lazarus
Fixed alignment of multiline TLabel. Fixed alignment of multiline TLabel.
Simplified and prettified MessageBoxen. Simplified and prettified MessageBoxen.