CTRL+W and other browser shortcuts

Discussion and feedback on Construct 2

Post » Fri Jan 13, 2012 2:19 am

Hey guys.

Currently, browser shortcuts kind of limit what controls you can use. For instance, right now when you crouch and jump in my game you close the tab, which is a bit annoying. Browsers have sort of claimed all the convenient key combinations to do annoying things. Is there any way for Construct to disable browser shortcuts, or at least prevent the CTRL+W shortcut? Because right now that's the most annoying one for me.
B
55
S
12
G
8
Posts: 339
Reputation: 9,334

Post » Fri Jan 13, 2012 5:00 am

According to the manual entry about the keyboard plugin browsers shortcuts should be intercepted. Maybe @Ashley forgot about Ctrl+W.
Or maybe it's some browser trickery once again.
New to Construct ? Where to start

Image Image

Image Image

Please attach a capx to any help request or bug report !
Moderator
B
280
S
105
G
86
Posts: 7,313
Reputation: 84,466

Post » Fri Jan 13, 2012 10:49 am

From the manual:

[quote]If any events exist for 'On key pressed' with a given key, Construct 2 blocks the browser from performing its normal action. For example, if you wish to prevent space bar scrolling down the page, add an empty 'On Space pressed' event, if you don't have one already.[/quote]
So if you add an empty 'On W pressed' event it should block it, but that particular combination may not be blockable for security reasons (so web pages cannot make it difficult to leave the page). You might need to adjust the controls...

Behaviors using default controls block their keypresses as well, but not custom control behaviors without 'On key pressed'. Also the 'Is key down' does not block the key, only 'On key pressed', since it's too late for Construct 2 to block the key in 'Is key down'.Ashley2012-01-13 10:49:45
Scirra Founder
B
386
S
229
G
87
Posts: 24,207
Reputation: 191,742

Post » Fri Jan 13, 2012 10:56 am

Awesome.



I had tested this trick but made the mistake of putting another "On ctrl down" in the blank event.
Thanks for the clarification/demonstration @Ashley.
New to Construct ? Where to start

Image Image

Image Image

Please attach a capx to any help request or bug report !
Moderator
B
280
S
105
G
86
Posts: 7,313
Reputation: 84,466


Return to Construct 2 General

Who is online

Users browsing this forum: NetOne and 5 guests