Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2016-10

TMouseinput mouse click.

9 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Larry Dalton

I am running Lazarus 1.6 on Windows 7. I have one application where I need to move the mouse to a certain point on the screen and then do a mouseclick from the program.

When I run the following procedure,

procedure TMain_Form.Button1Click(Sender: TObject);
var MousePos:Tpoint;
MyMouse:TMouseInput;
begin
MyMouse:=TMouseInput.Create;
MousePos:=Mouse.CursorPos;
MousePos.x:=200;
MousePos.y:=75;
Mouse.CursorPos:=MousePos;
MyMouse.Click(mbLeft,[]);
MyMouse.Destroy;
end;

I get the following error code : Abstract Method Called. Click OK to ignore and risk data corruption or Cancel to kill the program.

I know the problem is in the MyMouse.Click procedure. How do I make this work?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20161026/b7235365/attachment.html>

Reply by email

Balázs Székely
to Larry Dalton

Add lazmouseandkeyinput to the required packages, then:

uses MouseAndKeyInput;
procedure TForm1.Button1Click(Sender: TObject);
begin
  MouseInput.Move([], 200, 75);
  MouseInput.Click(mbLeft,[], 200, 75);
end;

On Wed, Oct 26, 2016 at 6:40 PM, Larry Dalton via Lazarus <

Show quoted text 35 lines
wrote: I am running Lazarus 1.6 on Windows 7. I have one application where I need to move the mouse to a certain point on the screen and then do a mouseclick from the program. When I run the following procedure, procedure TMain_Form.Button1Click(Sender: TObject); var MousePos:Tpoint; MyMouse:TMouseInput; begin MyMouse:=TMouseInput.Create; MousePos:=Mouse.CursorPos; MousePos.x:=200; MousePos.y:=75; Mouse.CursorPos:=MousePos; MyMouse.Click(mbLeft,[]); MyMouse.Destroy; end; I get the following error code : Abstract Method Called. Click OK to ignore and risk data corruption or Cancel to kill the program. I know the problem is in the MyMouse.Click procedure. How do I make this work? -- _______________________________________________ Lazarus mailing list http://lists.lazarus-ide.org/listinfo/lazarus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20161027/53e4b0e5/attachment.html>

Reply by email

Larry Dalton
to Balázs Székely

Worked great! Thanks!

Sent from my iPhone

Show quoted text 47 lines
On Oct 27, 2016, at 07:34, Balázs Székely via Lazarus wrote: Add lazmouseandkeyinput to the required packages, then: uses MouseAndKeyInput; procedure TForm1.Button1Click(Sender: TObject); begin MouseInput.Move([], 200, 75); MouseInput.Click(mbLeft,[], 200, 75); end; > On Wed, Oct 26, 2016 at 6:40 PM, Larry Dalton via Lazarus wrote: > I am running Lazarus 1.6 on Windows 7. I have one application where I need to move the mouse to a certain point on the screen and then do a mouseclick from the program. > > When I run the following procedure, > > procedure TMain_Form.Button1Click(Sender: TObject); > var MousePos:Tpoint; > MyMouse:TMouseInput; > begin > MyMouse:=TMouseInput.Create; > MousePos:=Mouse.CursorPos; > MousePos.x:=200; > MousePos.y:=75; > Mouse.CursorPos:=MousePos; > MyMouse.Click(mbLeft,[]); > MyMouse.Destroy; > > end; > > I get the following error code : Abstract Method Called. Click OK to ignore and risk data corruption or Cancel to kill the program. > > I know the problem is in the MyMouse.Click procedure. How do I make this work? > > -- > _______________________________________________ > Lazarus mailing list > > http://lists.lazarus-ide.org/listinfo/lazarus > -- _______________________________________________ Lazarus mailing list http://lists.lazarus-ide.org/listinfo/lazarus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20161027/83a2ca95/attachment.html>

Reply by email

Larry Dalton
to Balázs Székely: Add lazmouseandkeyinput to the required packages, then: uses MouseAndKeyInput; procedure…

Is there a procedure to print a string at the cursor?

Sent from my iPhone

Show quoted text 47 lines
On Oct 27, 2016, at 07:34, Balázs Székely via Lazarus wrote: Add lazmouseandkeyinput to the required packages, then: uses MouseAndKeyInput; procedure TForm1.Button1Click(Sender: TObject); begin MouseInput.Move([], 200, 75); MouseInput.Click(mbLeft,[], 200, 75); end; > On Wed, Oct 26, 2016 at 6:40 PM, Larry Dalton via Lazarus wrote: > I am running Lazarus 1.6 on Windows 7. I have one application where I need to move the mouse to a certain point on the screen and then do a mouseclick from the program. > > When I run the following procedure, > > procedure TMain_Form.Button1Click(Sender: TObject); > var MousePos:Tpoint; > MyMouse:TMouseInput; > begin > MyMouse:=TMouseInput.Create; > MousePos:=Mouse.CursorPos; > MousePos.x:=200; > MousePos.y:=75; > Mouse.CursorPos:=MousePos; > MyMouse.Click(mbLeft,[]); > MyMouse.Destroy; > > end; > > I get the following error code : Abstract Method Called. Click OK to ignore and risk data corruption or Cancel to kill the program. > > I know the problem is in the MyMouse.Click procedure. How do I make this work? > > -- > _______________________________________________ > Lazarus mailing list > > http://lists.lazarus-ide.org/listinfo/lazarus > -- _______________________________________________ Lazarus mailing list http://lists.lazarus-ide.org/listinfo/lazarus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20161027/2e92c5a7/attachment.html>

Reply by email

Balázs Székely
to Larry Dalton
>Is there a procedure to print a string at the cursor?
uses MouseAndKeyInput, LCLType;
procedure TForm1.Button1Click(Sender: TObject);
var
  Str: String;
begin
  MouseInput.Move([], 200, 75);
  MouseInput.Click(mbLeft,[], 200, 75);
  KeyInput.Press(VK_T);
  KeyInput.Press(VK_e);
  KeyInput.Press(VK_s);
  KeyInput.Press(VK_t);
end;
View this message in context: http://free-pascal-lazarus.989080.n3.nabble.com/Lazarus-TMouseinput-mouse-click-tp4050096p4050105.html Sent from the Free Pascal - Lazarus mailing list .

Reply by email

Larry Dalton
to Balázs Székely

Everything is printing in lower case. How do I fix that?

Sent from my iPhone

Balázs Székely wrote 26 lines
>> Is there a procedure to print a string at the cursor? uses MouseAndKeyInput, LCLType; procedure TForm1.Button1Click(Sender: TObject); var Str: String; begin MouseInput.Move([], 200, 75); MouseInput.Click(mbLeft,[], 200, 75); KeyInput.Press(VK_T); KeyInput.Press(VK_e); KeyInput.Press(VK_s); KeyInput.Press(VK_t); end; -- View this message in context: http://free-pascal-lazarus.989080.n3.nabble.com/Lazarus-TMouseinput-mouse-click-tp4050096p4050105.html Sent from the Free Pascal - Lazarus mailing list . -- _______________________________________________ Lazarus mailing list http://lists.lazarus-ide.org/listinfo/lazarus

Reply by email

Larry Dalton
to Balázs Székely: uses MouseAndKeyInput, LCLType; procedure TForm1.Button1Click(Sender: TObject); var Str:…

I can't get it to print an uppercase letter

Sent from my iPhone

Balázs Székely wrote 26 lines
>> Is there a procedure to print a string at the cursor? uses MouseAndKeyInput, LCLType; procedure TForm1.Button1Click(Sender: TObject); var Str: String; begin MouseInput.Move([], 200, 75); MouseInput.Click(mbLeft,[], 200, 75); KeyInput.Press(VK_T); KeyInput.Press(VK_e); KeyInput.Press(VK_s); KeyInput.Press(VK_t); end; -- View this message in context: http://free-pascal-lazarus.989080.n3.nabble.com/Lazarus-TMouseinput-mouse-click-tp4050096p4050105.html Sent from the Free Pascal - Lazarus mailing list . -- _______________________________________________ Lazarus mailing list http://lists.lazarus-ide.org/listinfo/lazarus

Reply by email

Larry Dalton
to Vojtěch Čihák

That helps a lot! Thanks to all of you!

Sent from my iPhone

Show quoted text 24 lines
On Oct 29, 2016, at 10:17, Vojtěch Čihák via Lazarus wrote: Hi, this works. Just check all methods available in KeyInput and MouseInput to see what it can really do. KeyInput.Apply([ssShift]); KeyInput.Press(VK_T); KeyInput.Unapply([ssShift]); KeyInput.Press(VK_e); KeyInput.Press(VK_s); KeyInput.Press(VK_t); V. ______________________________________________________________ > Od: Larry Dalton via Lazarus > Komu: Lazarus mailing list > Datum: 29.10.2016 15:44 > Předmět: Re: [Lazarus] TMouseinput mouse click. > I can't get it to print an uppercase letter -- _______________________________________________ Lazarus mailing list http://lists.lazarus-ide.org/listinfo/lazarus

Reply by email