right click ?

Home Forums General Programming right click ?

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #72316
    human fly
    Participant
      • Topics: 124
      • Replies: 1070
      • Total: 1194
      • ★★★★

      what is it that determines that it is RIGHT click,
      rather than left-click, that triggers the event?

      the demo file is DEMO Popup window, with method:
      customMouseDown

      simple thing i want to do: have a graphic rectangle
      with a mouseDown event.

      chheeeerzzz!

      #72319
      Mr.ToR
      Participant
        • Topics: 7
        • Replies: 51
        • Total: 58
        customMouseDown = function(Component, MouseEvent)
        if MouseEvent.mods:isLeftButtonDown() then
        -- do something
        elseif MouseEvent.mods:isRightButtonDown() then	
        -- do something else
        end
        #72320
        human fly
        Participant
          • Topics: 124
          • Replies: 1070
          • Total: 1194
          • ★★★★

          ok, thanks, but what if left and right are not mentioned,
          like in that demo?

          what if it is ‘isPopupMenu’ ? ie:

          if event.mods:isPopupMenu() then
          ret = m:show(0,0,0,0)
          #72321
          human fly
          Participant
            • Topics: 124
            • Replies: 1070
            • Total: 1194
            • ★★★★

            hey it works! but as:

            if event.mods:isLeftButtonDown() then

            MouseEvent.mods gives error:
            ‘no static ‘mods’ in class ‘MouseEvent’

            thanks. could you give a link to sources for this?
            what should i be reading? ie: re: event.mods and
            MouseEvent.

            haven’t looked into any of this at all.
            cheers!

            #72325
            human fly
            Participant
              • Topics: 124
              • Replies: 1070
              • Total: 1194
              • ★★★★

              strange thing, this MouseDown Callback:
              i am able to exclude the event.mods condition and
              substitute with

              ...
              ret = m:show(0,0,0,50)
              if ret ~= 0 then...

              (no mention of the mouse event)
              (with a popup) and it works. what is ‘ret’?

              and it works also with a blank custom component.
              but if i make it an ‘ordinary’ mousedown-type
              method, nothing happens. experimenting with this
              mouse callback thing, and with custom component,
              as opposed to having a button calling the function.

              ie: not working with component:setProperty, calling
              a tab, in a form that works elsewhere. am trying to
              establish what the distinction is.

              #72345
              Mr.ToR
              Participant
                • Topics: 7
                • Replies: 51
                • Total: 58

                human fly,

                my code is correct.

                it doesn’t have to be ‘event.mods’ or ‘MouseEvent.mods’
                actually, it can be any variable that is declared in the function.
                so basically

                customMouseDown = function(Component, MouseEvent)
                if MouseEvent.mods:isLeftButtonDown() then
                -- do something
                elseif MouseEvent.mods:isRightButtonDown() then	
                -- do something else
                end
                

                and

                customMouseDown = function(Component, CatEvent)
                if CatEvent.mods:isLeftButtonDown() then
                -- do something
                elseif CatEvent.mods:isRightButtonDown() then	
                -- do something else
                end
                

                are the same thing.

                Name of the variable is irrelevant. They are just there to serve as an interface between Ctrlr/juce and lua.

                We have here a method called customMouseDown that passes two variables to a lua function called customMouseDown and I called those variables Component and CatEvent. These variables’ order is important just like in any function but you can call them whatever you want.

                #72347
                human fly
                Participant
                  • Topics: 124
                  • Replies: 1070
                  • Total: 1194
                  • ★★★★

                  ok, yes that is filtering through 😉
                  (far be it for me to question..)
                  i was confused by isLeft.. or isRight..
                  where is that defined?

                  so i left it undefined to see what happens.
                  and it does it with either click.

                  takes a long time to get responses on this
                  forum – if at all.

                Viewing 7 posts - 1 through 7 (of 7 total)
                • The forum ‘Programming’ is closed to new topics and replies.
                There is currently 0 users and 75 guests online
                No users are currently active
                Forum Statistics
                Threads: 2,495, Posts: 17,374, Members: 77,605
                Most users ever online was 12 on January 22, 2019 3:47 pm
                Ctrlr