diff --git a/designer/objectinspector.pp b/designer/objectinspector.pp index f2dcaf38d5..87d2769e60 100644 --- a/designer/objectinspector.pp +++ b/designer/objectinspector.pp @@ -144,8 +144,11 @@ type FLastMouseMovePos : TPoint; Procedure HintTimer(sender : TObject); Procedure ResetHintTimer(Sender : TObject; Shift: TShiftstate; X,Y : Integer); + procedure CurrentEditMouseDown(Sender : TObject;Button:TMouseButton; Shift:TShiftState; X,Y:integer); + PRocedure CurrentEditDblClick(Sender : TObject); + function GetRow(Index:integer):TOIPropertyGridRow; function GetRowCount:integer; procedure ClearRows; @@ -333,7 +336,8 @@ begin Visible:=false; Enabled:=false; OnMouseMove := @ResetHintTimer; - + OnMouseDown := @CurrentEditMouseDown; + OnDblClick := @CurrentEditDblClick; end; ValueComboBox:=TComboBox.Create(Self); @@ -345,6 +349,8 @@ begin Enabled:=false; Parent:=Self; OnMouseMove := @ResetHintTimer; + OnMouseDown := @CurrentEditMouseDown; + OnDblClick := @CurrentEditDblClick; end; ValueButton:=TButton.Create(Self); @@ -855,6 +861,10 @@ begin // XXX // the MouseDown event is fired two times // this is a workaround + + //hide the hint + if FHintWindow.Visible then FHintWindow.Visible := False; + if FOldMouseDownY=Y then begin FOldMouseDownY:=-1; exit; @@ -1278,7 +1288,7 @@ begin FHintWindow.Visible := False; FHintTimer.Enabled := False; - FHintTimer.Enabled := True; + FHintTimer.Enabled := not ((ssLeft in Shift) or (ssRight in Shift) or (ssMiddle in Shift)); if (Sender is TOIPropertyGrid) then Begin @@ -1293,9 +1303,25 @@ begin end; procedure TOIPropertyGrid.WMMouseMove(var Msg: TWMMouseMove); +var + Shift : TShiftState; begin inherited; - ResetHintTimer(self,[],Msg.pos.x,Msg.Pos.Y); + Shift := KeystoShiftState(Msg.Keys); //KeystoShiftState found in Forms.pp + + ResetHintTimer(self,Shift,Msg.pos.x,Msg.Pos.Y); +end; + +procedure TOIPropertyGrid.CurrentEditMouseDown(Sender : TObject; + Button: TMouseButton; Shift: TShiftState; X, Y: integer); +begin + //hide the hint window! + if FHintWindow.Visible then FHintWindow.Visible := False; +end; + +PRocedure TOIPropertyGrid.CurrentEditDblClick(Sender : TObject); +begin + writeln('CURRENTEDITDBLCLICK!!!!'); end; //------------------------------------------------------------------------------ diff --git a/lcl/interfaces/gtk/gtkcallback.inc b/lcl/interfaces/gtk/gtkcallback.inc index a7afd53510..cc81738704 100644 --- a/lcl/interfaces/gtk/gtkcallback.inc +++ b/lcl/interfaces/gtk/gtkcallback.inc @@ -423,13 +423,10 @@ var ShiftState: TShiftState; 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); - if event^.Button in [4,5] then begin MessE.Msg := LM_MOUSEWHEEL; @@ -444,18 +441,20 @@ begin MessI.Keys := 0; case event^.Button of 1 : begin - if LMouseButtonDown then Exit; + if (LMouseButtonDown) and (not (Event^.theType = gdk_2button_press)) then Exit; MessI.Keys := MessI.Keys or MK_LBUTTON; + if event^.thetype = gdk_button_press then MessI.Msg := LM_LBUTTONDOWN else - MessI.Msg := LM_LBUTTONDBLCLK; - + MessI.Msg := LM_LBUTTONDBLCLK; + LMouseButtonDown := True; end; 2 : begin - if MMouseButtonDown then Exit; + if (MMouseButtonDown) and (not (Event^.theType = gdk_2button_press)) then Exit; + MessI.Keys := MessI.Keys or MK_MBUTTON; if event^.thetype = gdk_button_press then MessI.Msg := LM_MBUTTONDOWN @@ -464,7 +463,7 @@ begin MMouseButtonDown := True; end; 3 : begin - if RMouseButtonDown then Exit; + if (RMouseButtonDown) and (not (Event^.theType = gdk_2button_press)) then Exit; MessI.Keys := MessI.Keys or MK_RBUTTON; if event^.thetype = gdk_button_press then MessI.Msg := LM_RBUTTONDOWN @@ -474,6 +473,7 @@ begin end; else MessI.Msg := LM_NULL; end; //case + MessI.XPos := Trunc(Event^.X); MessI.YPos := Trunc(Event^.Y); if ssShift in ShiftState then MessI.Keys := MessI.Keys or MK_SHIFT; @@ -481,8 +481,7 @@ begin if ssLeft in ShiftState then MessI.Keys := MessI.Keys or MK_LBUTTON; if ssRight in ShiftState then MessI.Keys := MessI.Keys or MK_RBUTTON; if ssMiddle in ShiftState then MessI.Keys := MessI.Keys or MK_MBUTTON; - - if MessI.Msg <> LM_NULL then Result := DeliverPostMessage(Data, MessI); + if MessI.Msg <> LM_NULL then Result := DeliverPostMessage(Data, MessI); end; end; @@ -1415,6 +1414,11 @@ end; { ============================================================================= $Log$ + Revision 1.46 2001/11/21 14:55:31 lazarus + Changes for combobox to receive butondown and up events + DblClick events now working. + Shane + Revision 1.45 2001/11/20 17:20:45 lazarus Fixed designer problem with moving controls. Can no longer drag controls off the form. diff --git a/lcl/interfaces/gtk/gtkobject.inc b/lcl/interfaces/gtk/gtkobject.inc index 91b6393533..0fe3e59f67 100644 --- a/lcl/interfaces/gtk/gtkobject.inc +++ b/lcl/interfaces/gtk/gtkobject.inc @@ -1609,8 +1609,6 @@ begin LM_SYSCHAR, LM_SYSKEYUP: begin - if (sender is TMemo) then - Writeln('KEY-PRESS-EVENT for TMemo'); if (sender is TComboBox) then Begin ConnectSignal(PgtkObject(PgtkCombo(TComboBox(sender).handle)^.entry), 'key-press-event', @GTKKeyUpDown, GDK_KEY_PRESS_MASK); ConnectSignal(PgtkObject(PgtkCombo(TComboBox(sender).handle)^.entry), 'key-release-event', @GTKKeyUpDown, GDK_KEY_RELEASE_MASK); @@ -1651,13 +1649,31 @@ begin LM_MBUTTONDOWN, LM_MOUSEWHEEL : begin - ConnectSignal(gFixed, 'button-press-event', @gtkmousebtnpress, GDK_BUTTON_PRESS_MASK); + if (sender is TCustomComboBox) then + Begin + ConnectSignal(PgtkObject(PgtkCOmbo(gObject)^.entry), 'button-press-event', @gtkmousebtnpress, GDK_BUTTON_PRESS_MASK); + ConnectSignal(PgtkObject(PgtkCOmbo(gObject)^.button) , 'button-press-event', @gtkmousebtnpress, GDK_BUTTON_PRESS_MASK); +// Connecting the list seems to cause errors. Maybe we are returning the wrong boolean in the callback func +// ConnectSignal(PgtkObject(PgtkCOmbo(gObject)^.list), 'button-press-event', @gtkmousebtnpress, GDK_BUTTON_PRESS_MASK); + + end + else + ConnectSignal(gFixed, 'button-press-event', @gtkmousebtnpress, GDK_BUTTON_PRESS_MASK); end; LM_LBUTTONUP, LM_RBUTTONUP, LM_MBUTTONUP: begin + if (sender is TCustomComboBox) then + Begin + ConnectSignal(PgtkObject(PgtkCOmbo(gObject)^.entry), 'button-release-event', @gtkmousebtnrelease, GDK_BUTTON_RELEASE_MASK); + ConnectSignal(PgtkObject(PgtkCOmbo(gObject)^.button) , 'button-release-event', @gtkmousebtnrelease, GDK_BUTTON_RELEASE_MASK); +// Connecting the list seems to cause errors. Maybe we are returning the wrong boolean in the callback func +// ConnectSignal(PgtkObject(PgtkCOmbo(gObject)^.list), 'button-release-event', @gtkmousebtnrelease, GDK_BUTTON_RELEASE_MASK); + + end + else ConnectSignal(gFixed, 'button-release-event', @gtkmousebtnrelease, GDK_BUTTON_RELEASE_MASK); end; @@ -3323,6 +3339,11 @@ end; { ============================================================================= $Log$ + Revision 1.75 2001/11/21 14:55:33 lazarus + Changes for combobox to receive butondown and up events + DblClick events now working. + Shane + Revision 1.74 2001/11/20 18:30:32 lazarus Pressing DEL when form is the only thing selected in designer no longer crashes Lazarus. Shane