mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-17 04:49:19 +02:00
MG: fixed mouse capturing, OI edit focus
git-svn-id: trunk@3238 -
This commit is contained in:
parent
982d2882b7
commit
3355e474de
@ -22,10 +22,8 @@
|
|||||||
|
|
||||||
ToDo:
|
ToDo:
|
||||||
- TCustomComboBox has a bug: it can not store objects
|
- TCustomComboBox has a bug: it can not store objects
|
||||||
- MouseDown is always fired twice -> workaround
|
|
||||||
- clipping (almost everywhere)
|
- clipping (almost everywhere)
|
||||||
- TCustomComboBox don't know custom draw yet
|
- TCustomComboBox don't know custom draw yet
|
||||||
- improve TextHeight function
|
|
||||||
- combobox can't sort (exception)
|
- combobox can't sort (exception)
|
||||||
- backgroundcolor=clNone
|
- backgroundcolor=clNone
|
||||||
- DoubleClick on Property
|
- DoubleClick on Property
|
||||||
@ -150,7 +148,6 @@ type
|
|||||||
FCurrentEdit:TWinControl; // nil or ValueEdit or ValueComboBox
|
FCurrentEdit:TWinControl; // nil or ValueEdit or ValueComboBox
|
||||||
FCurrentButton:TWinControl; // nil or ValueButton
|
FCurrentButton:TWinControl; // nil or ValueButton
|
||||||
FDragging:boolean;
|
FDragging:boolean;
|
||||||
FOldMouseDownY:integer; // XXX workaround
|
|
||||||
FOnModified: TNotifyEvent;
|
FOnModified: TNotifyEvent;
|
||||||
FExpandedProperties:TStringList;
|
FExpandedProperties:TStringList;
|
||||||
FBorderStyle:TBorderStyle;
|
FBorderStyle:TBorderStyle;
|
||||||
@ -211,6 +208,9 @@ type
|
|||||||
protected
|
protected
|
||||||
procedure CreateParams(var Params: TCreateParams); override;
|
procedure CreateParams(var Params: TCreateParams); override;
|
||||||
|
|
||||||
|
procedure MouseDown(Button:TMouseButton; Shift:TShiftState; X,Y:integer); override;
|
||||||
|
procedure MouseMove(Shift:TShiftState; X,Y:integer); override;
|
||||||
|
procedure MouseUp(Button:TMouseButton; Shift:TShiftState; X,Y:integer); override;
|
||||||
public
|
public
|
||||||
ValueEdit:TEdit;
|
ValueEdit:TEdit;
|
||||||
ValueComboBox:TComboBox;
|
ValueComboBox:TComboBox;
|
||||||
@ -244,9 +244,6 @@ type
|
|||||||
function PropertyPath(Index:integer):string;
|
function PropertyPath(Index:integer):string;
|
||||||
function GetRowByPath(PropPath:string):TOIPropertyGridRow;
|
function GetRowByPath(PropPath:string):TOIPropertyGridRow;
|
||||||
|
|
||||||
procedure MouseDown(Button:TMouseButton; Shift:TShiftState; X,Y:integer); override;
|
|
||||||
procedure MouseMove(Shift:TShiftState; X,Y:integer); override;
|
|
||||||
procedure MouseUp(Button:TMouseButton; Shift:TShiftState; X,Y:integer); override;
|
|
||||||
function MouseToIndex(y:integer;MustExist:boolean):integer;
|
function MouseToIndex(y:integer;MustExist:boolean):integer;
|
||||||
|
|
||||||
property OnModified: TNotifyEvent read FOnModified write FOnModified;
|
property OnModified: TNotifyEvent read FOnModified write FOnModified;
|
||||||
@ -687,6 +684,7 @@ begin
|
|||||||
if (FItemIndex<>NewIndex) then begin
|
if (FItemIndex<>NewIndex) then begin
|
||||||
if (FItemIndex>=0) and (FItemIndex<FRows.Count) then
|
if (FItemIndex>=0) and (FItemIndex<FRows.Count) then
|
||||||
Rows[FItemIndex].Editor.Deactivate;
|
Rows[FItemIndex].Editor.Deactivate;
|
||||||
|
SetCaptureControl(nil);
|
||||||
FItemIndex:=NewIndex;
|
FItemIndex:=NewIndex;
|
||||||
if FCurrentEdit<>nil then begin
|
if FCurrentEdit<>nil then begin
|
||||||
FCurrentEdit.Visible:=false;
|
FCurrentEdit.Visible:=false;
|
||||||
@ -729,8 +727,9 @@ begin
|
|||||||
AlignEditComponents;
|
AlignEditComponents;
|
||||||
if FCurrentEdit<>nil then begin
|
if FCurrentEdit<>nil then begin
|
||||||
FCurrentEdit.Enabled:=true;
|
FCurrentEdit.Enabled:=true;
|
||||||
if (FDragging=false) and (FCurrentEdit.Showing) then
|
if (FDragging=false) and (FCurrentEdit.Showing) then begin
|
||||||
FCurrentEdit.SetFocus;
|
FCurrentEdit.SetFocus;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
if FCurrentButton<>nil then
|
if FCurrentButton<>nil then
|
||||||
FCurrentButton.Enabled:=true;
|
FCurrentButton.Enabled:=true;
|
||||||
@ -903,28 +902,54 @@ end;
|
|||||||
|
|
||||||
procedure TOIPropertyGrid.MouseDown(Button:TMouseButton; Shift:TShiftState;
|
procedure TOIPropertyGrid.MouseDown(Button:TMouseButton; Shift:TShiftState;
|
||||||
X,Y:integer);
|
X,Y:integer);
|
||||||
var
|
|
||||||
IconX,Index:integer;
|
|
||||||
PointedRow:TOIpropertyGridRow;
|
|
||||||
begin
|
begin
|
||||||
//ShowMessageDialog('X'+IntToStr(X)+',Y'+IntToStr(Y));
|
//ShowMessageDialog('X'+IntToStr(X)+',Y'+IntToStr(Y));
|
||||||
//inherited MouseDown(Button,Shift,X,Y);
|
inherited MouseDown(Button,Shift,X,Y);
|
||||||
// XXX
|
|
||||||
// the MouseDown event is fired two times
|
|
||||||
// this is a workaround
|
|
||||||
|
|
||||||
//hide the hint
|
//hide the hint
|
||||||
if FHintWindow.Visible then FHintWindow.Visible := False;
|
if FHintWindow.Visible then FHintWindow.Visible := False;
|
||||||
|
|
||||||
if FOldMouseDownY=Y then begin
|
|
||||||
FOldMouseDownY:=-1;
|
|
||||||
exit;
|
|
||||||
end else FOldMouseDownY:=Y;
|
|
||||||
|
|
||||||
if Button=mbLeft then begin
|
if Button=mbLeft then begin
|
||||||
if Cursor=crHSplit then begin
|
if Cursor=crHSplit then begin
|
||||||
FDragging:=true;
|
FDragging:=true;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TOIPropertyGrid.MouseMove(Shift:TShiftState; X,Y:integer);
|
||||||
|
var SplitDistance:integer;
|
||||||
|
begin
|
||||||
|
inherited MouseMove(Shift,X,Y);
|
||||||
|
|
||||||
|
SplitDistance:=X-SplitterX;
|
||||||
|
if FDragging then begin
|
||||||
|
if ssLeft in Shift then begin
|
||||||
|
SplitterX:=SplitterX+SplitDistance;
|
||||||
end else begin
|
end else begin
|
||||||
|
EndDragSplitter;
|
||||||
|
end;
|
||||||
|
end else begin
|
||||||
|
if (abs(SplitDistance)<=2) then begin
|
||||||
|
Cursor:=crHSplit;
|
||||||
|
end else begin
|
||||||
|
Cursor:=crDefault;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TOIPropertyGrid.MouseUp(Button:TMouseButton; Shift:TShiftState;
|
||||||
|
X,Y:integer);
|
||||||
|
var
|
||||||
|
IconX,Index:integer;
|
||||||
|
PointedRow:TOIpropertyGridRow;
|
||||||
|
WasDragging: boolean;
|
||||||
|
begin
|
||||||
|
WasDragging:=FDragging;
|
||||||
|
if FDragging then EndDragSplitter;
|
||||||
|
inherited MouseUp(Button,Shift,X,Y);
|
||||||
|
|
||||||
|
if Button=mbLeft then begin
|
||||||
|
if not WasDragging then begin
|
||||||
Index:=MouseToIndex(Y,false);
|
Index:=MouseToIndex(Y,false);
|
||||||
ItemIndex:=Index;
|
ItemIndex:=Index;
|
||||||
if (Index>=0) and (Index<FRows.Count) then begin
|
if (Index>=0) and (Index<FRows.Count) then begin
|
||||||
@ -943,40 +968,16 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TOIPropertyGrid.MouseMove(Shift:TShiftState; X,Y:integer);
|
|
||||||
var SplitDistance:integer;
|
|
||||||
begin
|
|
||||||
//inherited MouseMove(Shift,X,Y);
|
|
||||||
SplitDistance:=X-SplitterX;
|
|
||||||
if FDragging then begin
|
|
||||||
if ssLeft in Shift then begin
|
|
||||||
SplitterX:=SplitterX+SplitDistance;
|
|
||||||
end else begin
|
|
||||||
EndDragSplitter;
|
|
||||||
end;
|
|
||||||
end else begin
|
|
||||||
if (abs(SplitDistance)<=2) then begin
|
|
||||||
Cursor:=crHSplit;
|
|
||||||
end else begin
|
|
||||||
Cursor:=crDefault;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TOIPropertyGrid.MouseUp(Button:TMouseButton; Shift:TShiftState;
|
|
||||||
X,Y:integer);
|
|
||||||
begin
|
|
||||||
if FDragging then EndDragSplitter;
|
|
||||||
inherited MouseUp(Button,Shift,X,Y);
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TOIPropertyGrid.EndDragSplitter;
|
procedure TOIPropertyGrid.EndDragSplitter;
|
||||||
begin
|
begin
|
||||||
if FDragging then begin
|
if FDragging then begin
|
||||||
Cursor:=crDefault;
|
Cursor:=crDefault;
|
||||||
FDragging:=false;
|
FDragging:=false;
|
||||||
FPreferredSplitterX:=FSplitterX;
|
FPreferredSplitterX:=FSplitterX;
|
||||||
if FCurrentEdit<>nil then FCurrentEdit.SetFocus;
|
if FCurrentEdit<>nil then begin
|
||||||
|
SetCaptureControl(nil);
|
||||||
|
FCurrentEdit.SetFocus;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -164,7 +164,7 @@ type
|
|||||||
function WantChildKey(Child : TControl; var MEssage : TLMessage): Boolean; virtual;
|
function WantChildKey(Child : TControl; var MEssage : TLMessage): Boolean; virtual;
|
||||||
Procedure SetFocus; override;
|
Procedure SetFocus; override;
|
||||||
function SetFocusedControl(Control : TWinControl): Boolean ; Virtual;
|
function SetFocusedControl(Control : TWinControl): Boolean ; Virtual;
|
||||||
Procedure FocusControl(Control : TWinControl);
|
Procedure FocusControl(WinControl : TWinControl);
|
||||||
Function ShowModal : Integer;
|
Function ShowModal : Integer;
|
||||||
property Active : Boolean read FActive;
|
property Active : Boolean read FActive;
|
||||||
property BorderStyle : TFormBorderStyle
|
property BorderStyle : TFormBorderStyle
|
||||||
|
@ -124,11 +124,11 @@ end;
|
|||||||
Params: None
|
Params: None
|
||||||
Returns: Nothing
|
Returns: Nothing
|
||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
Procedure TCustomForm.FocusControl(Control : TWinControl);
|
Procedure TCustomForm.FocusControl(WinControl : TWinControl);
|
||||||
Begin
|
Begin
|
||||||
FActiveControl := Control;
|
FActiveControl := WinControl;
|
||||||
if HandleAllocated and Visible then
|
if HandleAllocated and Visible then
|
||||||
LCLLinux.SetFocus(Control.Handle);
|
LCLLinux.SetFocus(WinControl.Handle);
|
||||||
End;
|
End;
|
||||||
|
|
||||||
|
|
||||||
@ -1025,6 +1025,9 @@ end;
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.51 2002/08/24 12:54:59 lazarus
|
||||||
|
MG: fixed mouse capturing, OI edit focus
|
||||||
|
|
||||||
Revision 1.50 2002/08/17 15:45:32 lazarus
|
Revision 1.50 2002/08/17 15:45:32 lazarus
|
||||||
MG: removed ClientRectBugfix defines
|
MG: removed ClientRectBugfix defines
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user