[UPDATED: 11.12.2017] The Big NW.js Roundup - Tips & Tricks

Discussion and feedback on Construct 2

Post » Tue Dec 27, 2016 10:09 am

Steam Overlay needs a constant refresh in order to work correctly, black bars from letterbox are not refresh by canvas that's why you have this bug.
Image Image
B
26
S
15
G
142
Posts: 881
Reputation: 74,060

Post » Tue Dec 27, 2016 11:50 am

Thank you for your answer. Is there any way I could avoid this happening?
B
55
S
14
G
10
Posts: 287
Reputation: 7,677

Post » Tue Dec 27, 2016 2:05 pm

tecbug wrote:I have Steam overlay problem for my game exported in NWjs. Maybe you could help me. ...

Thanks for your feedback and also thanks to everyone else that provided feedback previously.
I see that the flash, I mean MadSpy is already helping you out so I will keep him doing the work for now. :P

@MadSpy Do you already know a workaround for this one?
(Would be better if we use Discord for this and only provide the fix here.)
ImageImageImage
B
68
S
24
G
78
Posts: 692
Reputation: 45,299

Post » Fri Dec 30, 2016 12:35 pm

Please consider adding this method of replacing the terrible right-click context menu (when you right-click on textbox and forms) with one that permits Cut / Copy / Paste methods:

Browser Execute Javascript:

Code: Select all
"var gui = require('nw.gui');
 
  var menu = new gui.Menu;
 
  menu.append(new gui.MenuItem({
    label: 'Cut',
    click: function() {
      document.execCommand('cut');
    }
  }));
 
  menu.append(new gui.MenuItem({
    label: 'Copy',
    click: function() {
      document.execCommand('copy');
    }
  }));
 
  menu.append(new gui.MenuItem({
    label: 'Paste',
    click: function() {
      document.execCommand('paste');
    }
  }));
 
  document.addEventListener('contextmenu', function(e) {
    e.preventDefault();
    if (e.target instanceof HTMLInputElement || e.target instanceof HTMLTextAreaElement || e.target.isContentEditable) {
      menu.popup(e.x, e.y);
    }
  });"


Sourced from here and works like a champ.
A big fan of JavaScript.
B
76
S
20
G
76
Posts: 2,284
Reputation: 47,552

Post » Fri Dec 30, 2016 12:40 pm

@TheRealDannyyy , @MadSpy any good news?

Unfortunately there is another issue:
BitDefender keeps on removing nw.exe from users system. It says it has some PUA's packed into it. I used latest NWjs v0.19.2.
I used Resource Hacker v.4.2.5 to change icon - maybe this is causing the problem. Did you encountered similar problems?
B
55
S
14
G
10
Posts: 287
Reputation: 7,677

Post » Fri Dec 30, 2016 6:04 pm

Colludium wrote:Please consider adding this method of replacing the terrible right-click context menu (when you right-click on textbox and forms) with one that permits Cut / Copy / Paste methods:
Browser Execute Javascript:
*Codebox Here*

Sourced from here and works like a champ.

Yeah I was thinking about adding that to the roundup, I also have my own method of doing this.
I'm not a JS expert so I let you be the judge, is my code more effecient or yours?

The code I use:
Code: Select all
"document.addEventListener('contextmenu', function(e){e.preventDefault();}, false);"


tecbug wrote:@TheRealDannyyy , @MadSpy any good news?

Unfortunately there is another issue:
BitDefender keeps on removing nw.exe from users system. It says it has some PUA's packed into it. I used latest NWjs v0.19.2.
I used Resource Hacker v.4.2.5 to change icon - maybe this is causing the problem. Did you encountered similar problems?

About the letterboxing thing, Madspy pretty much said that he should be able to provide a fix within his Steam plugin.
Greenworks users will most-likely have to use the browser action execute JS, in order to fix this on their ends.
There is currently no ETA, I guess it will be done after the festivities have come to an end.

Oh BitDefender, the antivirus software with anxiety issues.
I've had my fair share of experiences with it, not in combination with NW.js but with native software that I've developed.
I think there is not much that I can do about that, the NW.js team could try to modify their application in order for it to work well with BitDefender but there's a 90% chance that they will tell me to add "nw.exe" to the list of exceptions.

That's why I will do the same and recommend you to tell those users to take a look at THIS.
If you're not satisfied with that workaround, feel free to DOWNLOAD and use this software to replace the icon but I highly doubt that ResHack is at fault here.

Replace icon using Anolis Resorces:
  1. Open Resourcer.exe [.../bin/Resourcer.exe]
  2. Click "Open" and select "nw.exe" (32bit/64bit)
  3. Click on "Icon Image" and select the icon that you want to replace
  4. Click on "Replace" (should be enabled now)
  5. Click on "Browse" and select your new icon (I recommend importing a .png file, this program doesn't seem to like other formats)
  6. Click on "Load" and then "OK" if everything is alright
  7. Click on "Save" and that's it
Last edited by TheRealDannyyy on Sat Dec 31, 2016 4:01 am, edited 3 times in total.
ImageImageImage
B
68
S
24
G
78
Posts: 692
Reputation: 45,299

Post » Fri Dec 30, 2016 6:10 pm

TheRealDannyyy wrote:I'm not a JS expert so I let you be the judge, is my code more effecient or yours?

The code I use:
Code: Select all
"document.addEventListener('contextmenu', function(e){e.preventDefault();}, false);"


That only works if you don't want to have a Cut / Copy / Paste option by using a right click. Both sets of code are valid with different objectives.
A big fan of JavaScript.
B
76
S
20
G
76
Posts: 2,284
Reputation: 47,552

Post » Fri Dec 30, 2016 6:14 pm

Colludium wrote:That only works if you don't want to have a Cut / Copy / Paste option by using a right click. Both sets of code are valid with different objectives.

Alrighty, so your code doesn't completly remove right clicking and mine does?
If that's the case I might consider adding both methods to the roundup soon, also no ETA for this one.
ImageImageImage
B
68
S
24
G
78
Posts: 692
Reputation: 45,299

Post » Fri Dec 30, 2016 6:29 pm

TheRealDannyyy wrote:Alrighty, so your code doesn't completly remove right clicking and mine does?


That's correct - it permits right-click cut/copy/paste actions only. All other right-click context menus are prevented.
A big fan of JavaScript.
B
76
S
20
G
76
Posts: 2,284
Reputation: 47,552

Post » Mon Jan 09, 2017 9:35 am

FYI, NW.js 0.19.2 still produce black screen on OBS without '--disable-direct-composition'.
Image
B
82
S
30
G
12
Posts: 517
Reputation: 12,763

PreviousNext

Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 5 guests