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,314

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
247
S
85
G
40
Posts: 6,999
Reputation: 57,793

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
359
S
214
G
72
Posts: 22,951
Reputation: 178,578

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
247
S
85
G
40
Posts: 6,999
Reputation: 57,793


Return to Construct 2 General

Who is online

Users browsing this forum: Eisenhans, Televangelist and 12 guests