We help IT Professionals succeed at work.

Release Mouse click

Mohamadi
Mohamadi asked
on
Hi

how can i release mouse down event.
for exmaple, think that i have pressed a button, and now i want to release mouse capture programaticaly, not by release the mouse button.
this case is too useful when i use Notebook componente
in my application. imagine that case in notebook component and i want to change notebook page by for example pressing {F4}, while i have pressed right mouse button for resizing a column of a grid.
please help me!
Comment
Watch Question

Commented:
ReleaseCapture;


for example, when you want to move a TWinControl at runtime you would do this in the OnMouseDown event

begin
  ReleaseCapture;
  (Sender as TWinControl).Perform(WM_SYSCOMMAND, $f019, 0);
end;

Pete
====
http://www.HowToDoThings.com (Delphi articles)
http://www.Stuckindoors.com/delphi (Open source)

Author

Commented:
Hi
i have done your solution before.
try to use your solution, when you are resizing a dbgrid's column
i mean imagine ,you have pressed a Left mouse bottuon and resizing the
dbgrid's column.
i put a TActionList on a form and fire an action by {F4}

procedure TForm1.Action1Execute(Sender: TObject);
begin
 ReleaseCapture;
end;

if you fire the action while you are resizing the dbgrid
noting will happend. i want the mouse return to the it's normal state.
as i was befor try to resiz the dbgird's column.

i hope i could make myself understood.
Commented:
OnMouseDown I would remember the X,Y position of the Cursor by using GetCursorPos;

When you hit the button I would do this

if GetCaptureControl <> nil then
begin
  SetCursorPos(Saved.X, Saved.Y);
  GetCaptureControl.Perform(WM_LBUTTONUP, 0, 0);
end;

Pete
====
http://www.HowToDoThings.com (Delphi articles)
http://www.Stuckindoors.com/delphi (Open source)

Author

Commented:
Sorry that i was too late :(
i eas in an official juerny.
i dont want to back the mouse pointer to the old position,
i said to the old state!

pleas help me :(
thanks in advance
with best regard
NIMA

Author

Commented:
I do not want to be angry with me.
i send this point for you.
but please try to find out the solution
thanks
NIMA :)

Explore More ContentExplore courses, solutions, and other research materials related to this topic.