mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-21 08:08:36 +02:00
Improved the double click.
Shane git-svn-id: trunk@468 -
This commit is contained in:
parent
a80be48fd8
commit
34988490b3
@ -1273,7 +1273,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
if AHint = '' then Exit;
|
if AHint = '' then Exit;
|
||||||
Rect := FHintWindow.CalcHintRect(0,AHint,nil); //no maxwidth
|
Rect := FHintWindow.CalcHintRect(0,AHint,nil); //no maxwidth
|
||||||
Position := ClientToScreen(FLastMouseMovePos);
|
Position := Mouse.CursorPos;
|
||||||
Rect.Left := Position.X+10;
|
Rect.Left := Position.X+10;
|
||||||
Rect.Top := Position.Y+10;
|
Rect.Top := Position.Y+10;
|
||||||
Rect.Right := Rect.Left + Rect.Right+3;
|
Rect.Right := Rect.Left + Rect.Right+3;
|
||||||
|
@ -234,6 +234,7 @@ type
|
|||||||
property Color;
|
property Color;
|
||||||
property AutoHide : Boolean read FAutoHide write SetAutoHide;
|
property AutoHide : Boolean read FAutoHide write SetAutoHide;
|
||||||
property HideInterval : Integer read FHideInterval write SetHideInterval;
|
property HideInterval : Integer read FHideInterval write SetHideInterval;
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ end;
|
|||||||
Procedure THintWindow.AutoHideHint(Sender : TObject);
|
Procedure THintWindow.AutoHideHint(Sender : TObject);
|
||||||
Begin
|
Begin
|
||||||
TTimer(FAutoHideTimer).Enabled := False;
|
TTimer(FAutoHideTimer).Enabled := False;
|
||||||
if Visible then Hide;
|
if Visible then Visible := False;//Hide;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
|
|
||||||
@ -133,3 +133,4 @@ begin
|
|||||||
Inc(Result.Right, 8);
|
Inc(Result.Right, 8);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
@ -4,9 +4,14 @@
|
|||||||
// {$DEFINE ASSERT_IS_ON}
|
// {$DEFINE ASSERT_IS_ON}
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
|
const
|
||||||
|
DblClickTime = 250;//250 miliseconds or less between clicks is a double click
|
||||||
|
|
||||||
var
|
var
|
||||||
//testing
|
//testing
|
||||||
LMouseButtonDown,MMouseButtonDown,RMouseButtonDown : Boolean; //used to track the mouse buttons
|
LMouseButtonDown,MMouseButtonDown,RMouseButtonDown : Boolean; //used to track the mouse buttons
|
||||||
|
LLastClick, RLastClick, MLastClick : TDateTime;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -421,11 +426,34 @@ var
|
|||||||
MessI : TLMMouse;
|
MessI : TLMMouse;
|
||||||
MessE : TLMMouseEvent;
|
MessE : TLMMouseEvent;
|
||||||
ShiftState: TShiftState;
|
ShiftState: TShiftState;
|
||||||
|
ShowDebugging : Boolean;
|
||||||
|
parWindow : PgdkWindow; //the Parent's GDKWindow
|
||||||
begin
|
begin
|
||||||
//writeln('[gtkMouseBtnPress] ',ToBject(Data).ClassName,' ',Trunc(Event^.X),',',Trunc(Event^.Y));
|
//writeln('[gtkMouseBtnPress] ',ToBject(Data).ClassName,' ',Trunc(Event^.X),',',Trunc(Event^.Y));
|
||||||
EventTrace('Mouse button Press', data);
|
EventTrace('Mouse button Press', data);
|
||||||
Assert(False, Format('Trace:[gtkMouseBtnPress] ', []));
|
Assert(False, Format('Trace:[gtkMouseBtnPress] ', []));
|
||||||
ShiftState := GTKEventState2ShiftState(Event^.State);
|
ShiftState := GTKEventState2ShiftState(Event^.State);
|
||||||
|
|
||||||
|
ShowDebugging := False;
|
||||||
|
if ShowDebugging then
|
||||||
|
Begin
|
||||||
|
writeln('_______________');
|
||||||
|
Writeln('Button Down');
|
||||||
|
Writeln('Control = ',TControl(data).Name);
|
||||||
|
Writeln('Handle = ',Longint(TWinControl(data).Handle));
|
||||||
|
Writeln('Widget = ',LongInt(widget));
|
||||||
|
Writeln('Window = ',Longint(Event^.Window));
|
||||||
|
Writeln('Coords = ',trunc(Event^.x),',',trunc(Event^.Y));
|
||||||
|
Writeln('Event Type',Event^.thetype);
|
||||||
|
Writeln('Coords root = ',trunc(Event^.x_root),',',trunc(Event^.Y_root));
|
||||||
|
Writeln('State = ',event^.state);
|
||||||
|
Writeln('TGtkWidget^.Window is ',Longint(Widget^.Window));
|
||||||
|
parWindow := gtk_widget_get_parent_window(widget);
|
||||||
|
Writeln('Parwindow is ',LongInt(parwindow));
|
||||||
|
Writeln('_______________');
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
if event^.Button in [4,5]
|
if event^.Button in [4,5]
|
||||||
then begin
|
then begin
|
||||||
MessE.Msg := LM_MOUSEWHEEL;
|
MessE.Msg := LM_MOUSEWHEEL;
|
||||||
@ -437,16 +465,23 @@ begin
|
|||||||
Result := DeliverPostMessage(Data, MessE);
|
Result := DeliverPostMessage(Data, MessE);
|
||||||
end
|
end
|
||||||
else begin
|
else begin
|
||||||
|
Writeln('LLastClick = ',FormatDateTime('hh:mm:ss:zz',LLastClick));
|
||||||
MessI.Keys := 0;
|
MessI.Keys := 0;
|
||||||
case event^.Button of
|
case event^.Button of
|
||||||
1 : begin
|
1 : begin
|
||||||
if (LMouseButtonDown) and (not (Event^.theType = gdk_2button_press)) then Exit;
|
if (LMouseButtonDown) and (not (Event^.theType = gdk_2button_press)) then Exit;
|
||||||
MessI.Keys := MessI.Keys or MK_LBUTTON;
|
MessI.Keys := MessI.Keys or MK_LBUTTON;
|
||||||
|
if (now - LLastClick) <= ((1/86400)*(DblClickTime/1000)) then
|
||||||
|
Event^.theType := gdk_2Button_press;
|
||||||
|
LLastClick := Now;
|
||||||
|
|
||||||
if event^.thetype = gdk_button_press then
|
if event^.thetype = gdk_button_press then
|
||||||
MessI.Msg := LM_LBUTTONDOWN
|
MessI.Msg := LM_LBUTTONDOWN
|
||||||
else
|
else
|
||||||
|
begin
|
||||||
MessI.Msg := LM_LBUTTONDBLCLK;
|
MessI.Msg := LM_LBUTTONDBLCLK;
|
||||||
|
LLastClick := -1;
|
||||||
|
end;
|
||||||
|
|
||||||
LMouseButtonDown := True;
|
LMouseButtonDown := True;
|
||||||
|
|
||||||
@ -455,19 +490,35 @@ begin
|
|||||||
if (MMouseButtonDown) and (not (Event^.theType = gdk_2button_press)) then Exit;
|
if (MMouseButtonDown) and (not (Event^.theType = gdk_2button_press)) then Exit;
|
||||||
|
|
||||||
MessI.Keys := MessI.Keys or MK_MBUTTON;
|
MessI.Keys := MessI.Keys or MK_MBUTTON;
|
||||||
|
|
||||||
|
if (now - MLastClick) <= ((1/86400)*(DblClickTime/1000)) then
|
||||||
|
Event^.theType := gdk_2Button_press;
|
||||||
|
MLastClick := Now;
|
||||||
|
|
||||||
if event^.thetype = gdk_button_press then
|
if event^.thetype = gdk_button_press then
|
||||||
MessI.Msg := LM_MBUTTONDOWN
|
MessI.Msg := LM_MBUTTONDOWN
|
||||||
else
|
else
|
||||||
|
Begin
|
||||||
MessI.Msg := LM_MBUTTONDBLCLK;
|
MessI.Msg := LM_MBUTTONDBLCLK;
|
||||||
|
MLastClick := -1;
|
||||||
|
end;
|
||||||
MMouseButtonDown := True;
|
MMouseButtonDown := True;
|
||||||
end;
|
end;
|
||||||
3 : begin
|
3 : begin
|
||||||
if (RMouseButtonDown) and (not (Event^.theType = gdk_2button_press)) then Exit;
|
if (RMouseButtonDown) and (not (Event^.theType = gdk_2button_press)) then Exit;
|
||||||
MessI.Keys := MessI.Keys or MK_RBUTTON;
|
MessI.Keys := MessI.Keys or MK_RBUTTON;
|
||||||
|
|
||||||
|
if (now - RLastClick) <= ((1/86400)*(DblClickTime/1000)) then
|
||||||
|
Event^.theType := gdk_2Button_press;
|
||||||
|
RLastClick := Now;
|
||||||
|
|
||||||
if event^.thetype = gdk_button_press then
|
if event^.thetype = gdk_button_press then
|
||||||
MessI.Msg := LM_RBUTTONDOWN
|
MessI.Msg := LM_RBUTTONDOWN
|
||||||
else
|
else
|
||||||
|
Begin
|
||||||
MessI.Msg := LM_RBUTTONDBLCLK;
|
MessI.Msg := LM_RBUTTONDBLCLK;
|
||||||
|
RLastClick := -1;
|
||||||
|
end;
|
||||||
RMouseButtonDown := True;
|
RMouseButtonDown := True;
|
||||||
end;
|
end;
|
||||||
else MessI.Msg := LM_NULL;
|
else MessI.Msg := LM_NULL;
|
||||||
@ -1415,6 +1466,10 @@ end;
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.48 2001/11/29 18:41:27 lazarus
|
||||||
|
Improved the double click.
|
||||||
|
Shane
|
||||||
|
|
||||||
Revision 1.47 2001/11/21 19:32:32 lazarus
|
Revision 1.47 2001/11/21 19:32:32 lazarus
|
||||||
TComboBox can now be moved in FormEditor
|
TComboBox can now be moved in FormEditor
|
||||||
Shane
|
Shane
|
||||||
|
Loading…
Reference in New Issue
Block a user