Trying to get the last control of the last form focused when a dialog closes.

Still working on it.
Shane

git-svn-id: trunk@177 -
This commit is contained in:
lazarus 2001-02-06 20:59:17 +00:00
parent 7a970da46b
commit bde7e85bed
7 changed files with 62 additions and 19 deletions

View File

@ -1078,7 +1078,6 @@ end;
procedure TCustomSynEdit.DecPaintLock;
begin
Writeln('IN DECPAINT');
Dec(fPaintLock);
if (fPaintLock = 0) and HandleAllocated then begin
if sfScrollbarChanged in fStateFlags then
@ -2659,7 +2658,6 @@ procedure TCustomSynEdit.SetCaretXY(Value: TPoint);
var
nMaxX: integer;
begin
Writeln('IN SETCARETXY');
nMaxX := fMaxLeftChar;
if Value.Y > Lines.Count then
Value.Y := Lines.Count;
@ -3165,22 +3163,22 @@ var
cf: TCompositionForm;
{$ENDIF}
begin
Writeln('IN UPDATECARET');
Writeln('PAINTLOCK = '+inttostr(PaintLock));
Writeln('UPDATECARET---------------------------');
if (PaintLock <> 0) or not Focused then
Begin
Include(fStateFlags, sfCaretChanged);
end
Include(fStateFlags, sfCaretChanged)
else begin
Writeln('Inside UPDATECARET section-------');
Exclude(fStateFlags, sfCaretChanged);
CX := CaretXPix + FCaretOffset.X;
CY := CaretYPix + FCaretOffset.Y;
if (CX >= fGutterWidth) and (CX < ClientWidth)
and (CY >= 0) and (CY < ClientHeight)
then begin
Writeln('setting CaretPos to '+Inttostr(CX)+','+Inttostr(CY));
SetCaretPos(CX, CY);
ShowCaret;
end else begin
Writeln('hiding CaretPos');
HideCaret;
SetCaretPos(CX, CY);
end;

View File

@ -539,7 +539,7 @@ begin
y := Top;
while y <= top+height do
begin
if Controlatpos(TPOINT([x,y]),True) = nil then
//if Controlatpos(TPOINT([x,y]),True) = nil then
Canvas.Rectangle(x-left,y-top,x-left+1,y-top);
Inc(y, GridPoints.Y);
end;

View File

@ -808,7 +808,7 @@ if Command >= ecFirstParent then
except
GotoLine(0);
end;
TMainIDE(TSourceNotebook(FAOwner).MainIDE).speedbutton4.visible := not TMainIDE(TSourceNotebook(FAOwner).MainIDE).speedbutton4.visible;
//TMainIDE(TSourceNotebook(FAOwner).MainIDE).speedbutton4.visible := not TMainIDE(TSourceNotebook(FAOwner).MainIDE).speedbutton4.visible;
end;
ecPeriod : Begin

View File

@ -152,6 +152,7 @@ type
function WantChildKey(Child : TControl; var MEssage : TLMessage): Boolean; virtual;
Procedure SetFocus; override;
function SetFocusedControl(Control : TWinControl): Boolean ; Virtual;
Procedure FocusControl(Control : TWinControl);
Function ShowModal : Integer;
property Active : Boolean read FActive;
property BorderStyle : TFormBorderStyle read FBorderStyle write SetBorderStyle default bsSizeable;

View File

@ -802,13 +802,16 @@ procedure TControl.InvalidateControl(IsVisible, IsOpaque : Boolean);
var
Rect : TRect;
begin
Writeln('[INAVLIDATECONTROL]');
if (IsVisible or (csDesigning in ComponentState) and not (csNoDesignVisible in ControlStyle)) and
(Parent <> nil) and (Parent.HandleAllocated) then
Begin
// CNSendMessage(LM_REDRAW,Self,Nil);
Rect := BoundsRect;
InvalidateRect(parent.handle,@Rect, True);
CNSendMessage(LM_REDRAW,Self,Nil);
// Rect := BoundsRect;
// InvalidateRect(parent.handle,@Rect, True);
end;
Writeln('[INAVLIDATECONTROL] Done');
end;
{------------------------------------------------------------------------------}
@ -1289,8 +1292,9 @@ end;
{ =============================================================================
$Log$
Revision 1.13 2001/02/06 18:23:51 lazarus
Changed InvalidateControl
Revision 1.14 2001/02/06 20:59:16 lazarus
Trying to get the last control of the last form focused when a dialog closes.
Still working on it.
Shane
Revision 1.11 2001/02/04 04:18:12 lazarus

View File

@ -84,6 +84,20 @@ Begin
FOnDeactivate(Self);
end;
{------------------------------------------------------------------------------
Method: TCustomForm.FocusControl
Params: None
Returns: Nothing
------------------------------------------------------------------------------}
Procedure TCustomForm.FocusControl(Control : TWinControl);
Begin
Writeln('[FOCUSCONTROL]');
FActiveControl := Control;
LCLLinux.SetFocus(Control.Handle);
Writeln('[FOCUSCONTROL] DONE');
End;
{------------------------------------------------------------------------------
Method: TCustomForm.Notification
@ -156,7 +170,9 @@ end;
------------------------------------------------------------------------------}
Procedure TCustomForm.WMActivate(var Message : TLMActivate);
Begin
Writeln('[TCUSTOMFORM.WMACtivate]');
if Assigned(FOnActivate) then FOnActivate(Self);
Writeln('[TCUSTOMFORM.WMACtivate] Done');
end;
{------------------------------------------------------------------------------
@ -379,7 +395,7 @@ begin
end;
if FocusHandle <> 0
then begin
//TODO:should we write a function or use tcustomform's function? Windows.SetFocus(FocusHandle);
LCLLinux.SetFocus(FocusHandle);
Exit;
end;
end;
@ -837,6 +853,11 @@ end;
{ =============================================================================
$Log$
Revision 1.12 2001/02/06 20:59:17 lazarus
Trying to get the last control of the last form focused when a dialog closes.
Still working on it.
Shane
Revision 1.11 2001/02/02 20:13:39 lazarus
Codecompletion changes.
Added code to Uniteditor for code completion.

View File

@ -419,8 +419,7 @@ end;
{------------------------------------------------------------------------------}
Function TWinControl.Focused : Boolean;
Begin
Assert(False, 'Trace:TODO:[TWinControl.Focused]');
Result := True;
Result := (FHandle <> 0) and (GetFocus = FHandle);
end;
{------------------------------------------------------------------------------}
@ -725,9 +724,24 @@ end;
{ TWinControl SetFocus }
{------------------------------------------------------------------------------}
procedure TWinControl.SetFocus;
var
Form : TCustomForm;
begin
if Visible and HandleAllocated
then LCLLinux.SetFocus(Handle);
Writeln('[TWINCONTROL.SETFOCUS]');
Form := GetParentForm(self);
if Assigned(form) then
Writeln('Form is assigned') else Writeln('Form is NOT assigned');
if Form <> nil then
Form.FocusControl(self)
else
if Visible and HandleAllocated then
LCLLinux.SetFocus(Handle);
Writeln('[TWINCONTROL.SETFOCUS] done');
{ if Visible and HandleAllocated then
LCLLinux.SetFocus(Handle);
}
end;
{------------------------------------------------------------------------------}
@ -1915,6 +1929,11 @@ end;
{ =============================================================================
$Log$
Revision 1.19 2001/02/06 20:59:17 lazarus
Trying to get the last control of the last form focused when a dialog closes.
Still working on it.
Shane
Revision 1.18 2001/02/06 18:19:37 lazarus
Shane