Danwood's Recent Forum Activity

  • Could you precisely explain your problem based on "what you want to achieve" and "what the problems are", sorry but I'm a little confused right now.

    The previous problem was the scrolling icon appearing when clicking middle mouse.

    The code you gave me disabled completely middle mouse interactions, so it solved the problem but prevented the game from using the MMB.

    So i found a new code that works just fine (disables the scrolling icon, but allows to use MMB on objects).

    this one: "document.body.onmousedown = function(e) { if (e.button === 1) return false; }"

    Now, the only issue is not really a big deal, i just need to know if there is a "global" form/ID for button objects as well (like "body" for other objects), so i dont need to assign a formID to all the 100+ buttons in my projects

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • > This one works as intended, it disables the scroll icon, but retains the ability to interact with MMB

    > document.body.onmousedown = function(e) { if (e.button === 1) return false; }

    >

    He's on it, might take a little while seems to be busy at the moment.

    By the way, what about the previous one with the rightclick context menu, do right click actions work as intended?

    They do

    The new code works fine for MMB, i just need to assign a form ID to buttons as well (unless there is another "body" for them too)

  • This one works as intended, it disables the scroll icon, but retains the ability to interact with MMB

    document.body.onmousedown = function(e) { if (e.button === 1) return false; }

  • > Yes it's something about scrolling! But the new code still doesn't work (does "body" represents all the objects?).

    >

    It should include everything exept form elements and how you block it for form elements is already mentioned above.

    Now i see it why it didn't work! I was accidentally clicking on a button

    Is there also another universal form for button objects like "body"? It would save me a lot of time instead of assigning a form id to 100 buttons

    Btw thank you so much!

    EDIT: nevermind, apparently, the code disabled every use of middle mouse, i would need a way to only prevent the scroll thing to appear, not disabling MMB as a whole

  • So you kinda have scrollable game I guess, well try the code from below just execute it in the way you already know.

    "$(function(){$('body').mousedown(function(e){if(e.button==1)return false});});"[/code:15fz32i3]
    

    Yes it's something about scrolling! But the new code still doesn't work (does "body" represents all the objects?).

  • In the object propeties of the form object that you want to use.

    That's only for the button objects, the problem occurs when middle clicking on everything, even on the background

  • Glad to see there is a way to prevent it! However, I'm stuck here:

    4. Set an ID for the form element(s) where you want to prevent middle clicking

    I didn't even know there is a way to assign an ID to whole categories of objects, how can i do it?

  • Could you provide more details please, maybe screenshots?

    Also please note that I only tested this using NWjs, the result of this script may vary using other browsers.

    EDIT: Never mind I know what you mean now, I thought there were problems with the script.

    To be honest I have no clue how to prevent that icon from appearing, there might be a way to block the button itself.

    I'll ask this question to some experienced JS devs, they might find an easy solution for you soon.

    Thank you! I tried to take a screenshot but as i press any button the icon disappears. It's problematic not for the icon itself, but the fact it makes it difficult to properly use the middle mouse button.

  • I know that this bug report is closed, however for people that stumble upon this post for a fix here you go:

    1. Add the "browser" plugin to your project

    2. Add an event "on start of layout" (you might have to use it on a globally included eventsheet)

    3. Add the browser action "execute Javascript" and use the code from below

    4. All right click actions should be blocked from now on

    Code:

    "document.addEventListener('contextmenu', function(e){e.preventDefault();}, false);"[/code:2jz76is9]
    

    There is a similiar thing happening when middle-mouse clicking: it appears a scrolling icon and the some key actions are prevented unless i remove it. Is there a way to disable it too?

  • I know that this bug report is closed, however for people that stumble upon this post for a fix here you go:

    1. Add the "browser" plugin to your project

    2. Add an event "on start of layout" (you might have to use it on a globally included eventsheet)

    3. Add the browser action "execute Javascript" and use the code from below

    4. All right click actions should be blocked from now on

    Code:

    "document.addEventListener('contextmenu', function(e){e.preventDefault();}, false);"[/code:3cyxe9vu]
    

    Thank you so much!! It won't happen anymore

  • Danwood I see that occuring as well on preview in the opera browser, might worth investigating

    I wonder if there's a way to fix it myself, or if we need to wait for a future NW update <img src="{SMILIES_PATH}/icon_rolleyes.gif" alt=":roll:" title="Rolling Eyes">

    UPDATE: seems like nightly build today fixed it! (and that's why i always update <img src="{SMILIES_PATH}/icon_razz.gif" alt=":P" title="Razz">)

    https://dl.nwjs.io/live-build/10-20-201 ... 6/v0.18.1/

  • I've also noticed there is a chrome menu appearing when right clicking on a button!

Danwood's avatar

Danwood

Member since 2 Jan, 2014

None one is following Danwood yet!

Trophy Case

  • 10-Year Club
  • Forum Contributor Made 100 posts in the forums
  • Regular Visitor Visited Construct.net 7 days in a row
  • Steady Visitor Visited Construct.net 30 days in a row
  • RTFM Read the fabulous manual
  • x5
    Great Comment One of your comments gets 3 upvotes
  • Email Verified

Progress

16/44
How to earn trophies