Results 1 to 4 of 4

Thread: gambas how to make fake mouse button

  1. #1
    Join Date
    May 2010
    Beans
    107
    Distro
    Ubuntu 10.04 Lucid Lynx

    gambas how to make fake mouse button

    I'm using gambas 3.1.1

    well I know how to do mouse move
    Code:
    mouse.move(x,y)
    (component gb.desktop)

    I know how to do key press
    Code:
    Desktop.SendKeys("a")
    (component gb.desktop)

    how go I make "fake" mouse press

    how do I make "fake" key up press? - as
    Code:
    Desktop.SendKeys(Key.up)
    - doesn't work properly
    Last edited by psihokiller4; June 13th, 2012 at 12:03 PM.
    19.9.2012 moved from noob distro to Fedora after 3 years
    thank you all in learning Linux expirience

  2. #2
    Join Date
    Apr 2008
    Location
    Buckinghamshire, UK
    Beans
    141
    Distro
    Ubuntu 13.04 Raring Ringtail

    Re: gambas how to make fake mouse button

    I don't know what you are trying to do but will say that it is unusual to send key events to a program which itself is event driven. Presumably after you have 'sent' the mouse event, you then want to do something. Well just do it by invoking the mouse class that you want to use.

    Here is a simple example (I am assuming Gambas 2 not 3):
    Drag the following onto a new projects FMain form: a TextBox, two buttons and a timer (from special tab). Leave all default object names as Gambas assigns them (TextBox1, Button1, Button2, Timer1)

    Open the FMain class file. Paste the following below the two default classes (or delete the default classes [_new() and Form_open()] first.

    When you run the program, the button1 class will flip the textbox. Clicking Button2 will automate this by invoking button1_mouseup() every second. I have used the mouseup events but could just as easily have used the click or mousedown events.
    Code:
    '--------------------------------------------------
    PUBLIC SUB Button1_MouseUp()
      IF TextBox1.Text = "TextBox1" OR TextBox1.text = "flip" THEN 
        TextBox1.text = "flop"
      ELSE 
        TextBox1.text = "flip"
      ENDIF 
    END
    '--------------------------------------------------
    PUBLIC SUB Button2_Click()
      IF Timer1.enabled THEN 
        Timer1.Enabled = FALSE
      ELSE 
        Timer1.Enabled = TRUE
      ENDIF 
    END
    '--------------------------------------------------
    PUBLIC SUB Timer1_Timer()
      Button1_MouseUp()
    END
    '--------------------------------------------------

  3. #3
    Join Date
    May 2010
    Beans
    107
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: gambas how to make fake mouse button

    sorry I'm using gambas 3.1.1

    no sorry it's not what I wanted this are turning on and off buttons witch doesn't matter for mouse press (except for beginning)

    what I want is that program would press mousebutton
    and not actually changing button or initialising button properties

    I don't want to follow function that's on that button but that it presses mouse button and IF there's a function on that button that it follows it

    I don't know how to explain

    like autokey program but that would be written in gambas


    maybe what distract you (fake)
    why "fake" don't know
    Send fake keyboard events
    http://gambasdoc.org/help/comp/gb.de...sktop/sendkeys
    Last edited by psihokiller4; June 13th, 2012 at 02:12 PM.
    19.9.2012 moved from noob distro to Fedora after 3 years
    thank you all in learning Linux expirience

  4. #4
    Join Date
    May 2010
    Beans
    107
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: gambas how to make fake mouse button

    bump anyone knows how could I manage that with bypasses? system calls or whatever?
    19.9.2012 moved from noob distro to Fedora after 3 years
    thank you all in learning Linux expirience

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •