diff --git a/designer/objectinspector.pp b/designer/objectinspector.pp index 694133db51..7967fa6777 100644 --- a/designer/objectinspector.pp +++ b/designer/objectinspector.pp @@ -1273,7 +1273,7 @@ begin end; if AHint = '' then Exit; Rect := FHintWindow.CalcHintRect(0,AHint,nil); //no maxwidth - Position := ClientToScreen(FLastMouseMovePos); + Position := Mouse.CursorPos; Rect.Left := Position.X+10; Rect.Top := Position.Y+10; Rect.Right := Rect.Left + Rect.Right+3; diff --git a/lcl/forms.pp b/lcl/forms.pp index 47542aa7d1..8abe2d014b 100644 --- a/lcl/forms.pp +++ b/lcl/forms.pp @@ -234,6 +234,7 @@ type property Color; property AutoHide : Boolean read FAutoHide write SetAutoHide; property HideInterval : Integer read FHideInterval write SetHideInterval; + end; diff --git a/lcl/include/hintwindow.inc b/lcl/include/hintwindow.inc index 538af3db91..f097ab84b6 100644 --- a/lcl/include/hintwindow.inc +++ b/lcl/include/hintwindow.inc @@ -47,7 +47,7 @@ end; Procedure THintWindow.AutoHideHint(Sender : TObject); Begin TTimer(FAutoHideTimer).Enabled := False; - if Visible then Hide; + if Visible then Visible := False;//Hide; End; @@ -133,3 +133,4 @@ begin Inc(Result.Right, 8); end; + diff --git a/lcl/interfaces/gtk/gtkcallback.inc b/lcl/interfaces/gtk/gtkcallback.inc index f43187f484..8046fa13fb 100644 --- a/lcl/interfaces/gtk/gtkcallback.inc +++ b/lcl/interfaces/gtk/gtkcallback.inc @@ -4,9 +4,14 @@ // {$DEFINE ASSERT_IS_ON} {$ENDIF} +const + DblClickTime = 250;//250 miliseconds or less between clicks is a double click + var //testing LMouseButtonDown,MMouseButtonDown,RMouseButtonDown : Boolean; //used to track the mouse buttons +LLastClick, RLastClick, MLastClick : TDateTime; + @@ -421,11 +426,34 @@ var MessI : TLMMouse; MessE : TLMMouseEvent; ShiftState: TShiftState; + ShowDebugging : Boolean; + parWindow : PgdkWindow; //the Parent's GDKWindow begin //writeln('[gtkMouseBtnPress] ',ToBject(Data).ClassName,' ',Trunc(Event^.X),',',Trunc(Event^.Y)); EventTrace('Mouse button Press', data); Assert(False, Format('Trace:[gtkMouseBtnPress] ', [])); 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] then begin MessE.Msg := LM_MOUSEWHEEL; @@ -437,16 +465,23 @@ begin Result := DeliverPostMessage(Data, MessE); end else begin + Writeln('LLastClick = ',FormatDateTime('hh:mm:ss:zz',LLastClick)); MessI.Keys := 0; case event^.Button of 1 : begin if (LMouseButtonDown) and (not (Event^.theType = gdk_2button_press)) then Exit; 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 MessI.Msg := LM_LBUTTONDOWN else - MessI.Msg := LM_LBUTTONDBLCLK; + begin + MessI.Msg := LM_LBUTTONDBLCLK; + LLastClick := -1; + end; LMouseButtonDown := True; @@ -455,19 +490,35 @@ begin if (MMouseButtonDown) and (not (Event^.theType = gdk_2button_press)) then Exit; 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 MessI.Msg := LM_MBUTTONDOWN else - MessI.Msg := LM_MBUTTONDBLCLK; + Begin + MessI.Msg := LM_MBUTTONDBLCLK; + MLastClick := -1; + end; MMouseButtonDown := True; end; 3 : begin if (RMouseButtonDown) and (not (Event^.theType = gdk_2button_press)) then Exit; 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 MessI.Msg := LM_RBUTTONDOWN else - MessI.Msg := LM_RBUTTONDBLCLK; + Begin + MessI.Msg := LM_RBUTTONDBLCLK; + RLastClick := -1; + end; RMouseButtonDown := True; end; else MessI.Msg := LM_NULL; @@ -1415,6 +1466,10 @@ end; { ============================================================================= $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 TComboBox can now be moved in FormEditor Shane