Rechte-Maustaste-gehalten-Aktion?

  • #1, by CrossThursday, 05. September 2013, 18:50 7 years ago
    Gibt es eine Möglichkeit, jeweils eine Rechte-Maustaste-gehalten- und -losgelassen-Aktion zu erstellen, die genauso funktionieren, wie die bei den Mauseinstellungen vorgegebenen für die linke Maustaste?

    Is there any way to create a "hold-right-mousebutton-action" that works similar to the hold-left-mousebutton-action-preset?

    Wäre für jeden Hinweis dankbar.

    Newbie

    92 Posts


  • #2, by afrlmeThursday, 05. September 2013, 19:16 7 years ago
    hmm not via the editor & the event handler only supports right button down, up, double click but not hold or holding...

    I suppose you could create a work around with Lua & the event handler possibly...

    something like on right button down set state/condition for pressed & then create some kind of timer thing maybe with the get time function & then if time has passed perform some action & on right button up set condition/state back to default.


    local timer = getTime() -- create the initial timer variable
    local tState = 0 -- set the initial state of the timer (mainLoop only checks if state = "1")
    local tHoldTime = 500 -- time value is in ms

    -- let's create the function for the mainLoop handler!
    function onMainLoop()
    if tState == 1 and timer >= tHoldTime then
    tState = 0 -- reset state back to default...
    -- do some action
    end
    end

    -- let's create the function for the mouseEvent listener!
    function onMouseEvent(eventType, mousePosition)
    if eventType == eEvtRightButtonDown then timer = getTime({flags=1, reset=true}); tState = 1 end
    if eventType == eEvtRightButtonUp then tState = 0 end
    end

    -- let's create the mouseEvent listener!
    registerEventHandler("mouseEvent", "onMouseEvent", {eEvtMouseMove, eEvtMouseLeftButtonDoubleClick, eEvtMouseLeftButtonDown, eEvtMouseLeftButtonUp, eEvtMouseLeftButtonHold, eEvtMouseLeftButtonHolding, eEvtMouseRightButtonDoubleClick, eEvtMouseRightButtonDown, eEvtMouseRightButtonUp, eEvtMouseMiddleButtonDown, eEvtMouseMiddleButtonUp, eEvtMouseWheelUp, eEvtMouseWheelDown})

    -- let's create the loop handler!
    registerEventHandler("mainLoop", "onMainLoop")
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24


    this is just a rough example of something you could probably do...
    this is mostly written off the top of my head, so I'm not 100% sure if it's correct or not.

    Imperator

    6815 Posts

  • #3, by CrossFriday, 06. September 2013, 08:56 7 years ago
    Thanks a lot. I'll give it a try.

    Newbie

    92 Posts

Write post