mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-03 14:38:16 +02:00
Changes for combobox to receive butondown and up events
DblClick events now working. Shane git-svn-id: trunk@447 -
This commit is contained in:
parent
91d1543e1d
commit
b01d62a154
@ -144,8 +144,11 @@ type
|
|||||||
FLastMouseMovePos : TPoint;
|
FLastMouseMovePos : TPoint;
|
||||||
Procedure HintTimer(sender : TObject);
|
Procedure HintTimer(sender : TObject);
|
||||||
Procedure ResetHintTimer(Sender : TObject; Shift: TShiftstate; X,Y : Integer);
|
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 GetRow(Index:integer):TOIPropertyGridRow;
|
||||||
function GetRowCount:integer;
|
function GetRowCount:integer;
|
||||||
procedure ClearRows;
|
procedure ClearRows;
|
||||||
@ -333,7 +336,8 @@ begin
|
|||||||
Visible:=false;
|
Visible:=false;
|
||||||
Enabled:=false;
|
Enabled:=false;
|
||||||
OnMouseMove := @ResetHintTimer;
|
OnMouseMove := @ResetHintTimer;
|
||||||
|
OnMouseDown := @CurrentEditMouseDown;
|
||||||
|
OnDblClick := @CurrentEditDblClick;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
ValueComboBox:=TComboBox.Create(Self);
|
ValueComboBox:=TComboBox.Create(Self);
|
||||||
@ -345,6 +349,8 @@ begin
|
|||||||
Enabled:=false;
|
Enabled:=false;
|
||||||
Parent:=Self;
|
Parent:=Self;
|
||||||
OnMouseMove := @ResetHintTimer;
|
OnMouseMove := @ResetHintTimer;
|
||||||
|
OnMouseDown := @CurrentEditMouseDown;
|
||||||
|
OnDblClick := @CurrentEditDblClick;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
ValueButton:=TButton.Create(Self);
|
ValueButton:=TButton.Create(Self);
|
||||||
@ -855,6 +861,10 @@ begin
|
|||||||
// XXX
|
// XXX
|
||||||
// the MouseDown event is fired two times
|
// the MouseDown event is fired two times
|
||||||
// this is a workaround
|
// this is a workaround
|
||||||
|
|
||||||
|
//hide the hint
|
||||||
|
if FHintWindow.Visible then FHintWindow.Visible := False;
|
||||||
|
|
||||||
if FOldMouseDownY=Y then begin
|
if FOldMouseDownY=Y then begin
|
||||||
FOldMouseDownY:=-1;
|
FOldMouseDownY:=-1;
|
||||||
exit;
|
exit;
|
||||||
@ -1278,7 +1288,7 @@ begin
|
|||||||
FHintWindow.Visible := False;
|
FHintWindow.Visible := False;
|
||||||
|
|
||||||
FHintTimer.Enabled := 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
|
if (Sender is TOIPropertyGrid) then
|
||||||
Begin
|
Begin
|
||||||
@ -1293,9 +1303,25 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TOIPropertyGrid.WMMouseMove(var Msg: TWMMouseMove);
|
procedure TOIPropertyGrid.WMMouseMove(var Msg: TWMMouseMove);
|
||||||
|
var
|
||||||
|
Shift : TShiftState;
|
||||||
begin
|
begin
|
||||||
inherited;
|
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;
|
end;
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
@ -423,13 +423,10 @@ var
|
|||||||
ShiftState: TShiftState;
|
ShiftState: TShiftState;
|
||||||
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);
|
||||||
|
|
||||||
if event^.Button in [4,5]
|
if event^.Button in [4,5]
|
||||||
then begin
|
then begin
|
||||||
MessE.Msg := LM_MOUSEWHEEL;
|
MessE.Msg := LM_MOUSEWHEEL;
|
||||||
@ -444,18 +441,20 @@ begin
|
|||||||
MessI.Keys := 0;
|
MessI.Keys := 0;
|
||||||
case event^.Button of
|
case event^.Button of
|
||||||
1 : begin
|
1 : begin
|
||||||
if LMouseButtonDown 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 event^.thetype = gdk_button_press then
|
if event^.thetype = gdk_button_press then
|
||||||
MessI.Msg := LM_LBUTTONDOWN
|
MessI.Msg := LM_LBUTTONDOWN
|
||||||
else
|
else
|
||||||
MessI.Msg := LM_LBUTTONDBLCLK;
|
MessI.Msg := LM_LBUTTONDBLCLK;
|
||||||
|
|
||||||
LMouseButtonDown := True;
|
LMouseButtonDown := True;
|
||||||
|
|
||||||
end;
|
end;
|
||||||
2 : begin
|
2 : begin
|
||||||
if MMouseButtonDown 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 event^.thetype = gdk_button_press then
|
if event^.thetype = gdk_button_press then
|
||||||
MessI.Msg := LM_MBUTTONDOWN
|
MessI.Msg := LM_MBUTTONDOWN
|
||||||
@ -464,7 +463,7 @@ begin
|
|||||||
MMouseButtonDown := True;
|
MMouseButtonDown := True;
|
||||||
end;
|
end;
|
||||||
3 : begin
|
3 : begin
|
||||||
if RMouseButtonDown 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 event^.thetype = gdk_button_press then
|
if event^.thetype = gdk_button_press then
|
||||||
MessI.Msg := LM_RBUTTONDOWN
|
MessI.Msg := LM_RBUTTONDOWN
|
||||||
@ -474,6 +473,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
else MessI.Msg := LM_NULL;
|
else MessI.Msg := LM_NULL;
|
||||||
end; //case
|
end; //case
|
||||||
|
|
||||||
MessI.XPos := Trunc(Event^.X);
|
MessI.XPos := Trunc(Event^.X);
|
||||||
MessI.YPos := Trunc(Event^.Y);
|
MessI.YPos := Trunc(Event^.Y);
|
||||||
if ssShift in ShiftState then MessI.Keys := MessI.Keys or MK_SHIFT;
|
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 ssLeft in ShiftState then MessI.Keys := MessI.Keys or MK_LBUTTON;
|
||||||
if ssRight in ShiftState then MessI.Keys := MessI.Keys or MK_RBUTTON;
|
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 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;
|
||||||
|
|
||||||
end;
|
end;
|
||||||
@ -1415,6 +1414,11 @@ end;
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$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
|
Revision 1.45 2001/11/20 17:20:45 lazarus
|
||||||
Fixed designer problem with moving controls.
|
Fixed designer problem with moving controls.
|
||||||
Can no longer drag controls off the form.
|
Can no longer drag controls off the form.
|
||||||
|
@ -1609,8 +1609,6 @@ begin
|
|||||||
LM_SYSCHAR,
|
LM_SYSCHAR,
|
||||||
LM_SYSKEYUP:
|
LM_SYSKEYUP:
|
||||||
begin
|
begin
|
||||||
if (sender is TMemo) then
|
|
||||||
Writeln('KEY-PRESS-EVENT for TMemo');
|
|
||||||
if (sender is TComboBox) then Begin
|
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-press-event', @GTKKeyUpDown, GDK_KEY_PRESS_MASK);
|
||||||
ConnectSignal(PgtkObject(PgtkCombo(TComboBox(sender).handle)^.entry), 'key-release-event', @GTKKeyUpDown, GDK_KEY_RELEASE_MASK);
|
ConnectSignal(PgtkObject(PgtkCombo(TComboBox(sender).handle)^.entry), 'key-release-event', @GTKKeyUpDown, GDK_KEY_RELEASE_MASK);
|
||||||
@ -1651,13 +1649,31 @@ begin
|
|||||||
LM_MBUTTONDOWN,
|
LM_MBUTTONDOWN,
|
||||||
LM_MOUSEWHEEL :
|
LM_MOUSEWHEEL :
|
||||||
begin
|
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;
|
end;
|
||||||
|
|
||||||
LM_LBUTTONUP,
|
LM_LBUTTONUP,
|
||||||
LM_RBUTTONUP,
|
LM_RBUTTONUP,
|
||||||
LM_MBUTTONUP:
|
LM_MBUTTONUP:
|
||||||
begin
|
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);
|
ConnectSignal(gFixed, 'button-release-event', @gtkmousebtnrelease, GDK_BUTTON_RELEASE_MASK);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -3323,6 +3339,11 @@ end;
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$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
|
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.
|
Pressing DEL when form is the only thing selected in designer no longer crashes Lazarus.
|
||||||
Shane
|
Shane
|
||||||
|
Loading…
Reference in New Issue
Block a user