Canvas keyboard "KeyBack" & Web explorers

Just starting out? Need help? Post your questions and find answers here.
User avatar
DjPoke
Posts: 22
Joined: Sat Dec 19, 2015 5:27 pm
Location: France (Corsica)
Contact:

Canvas keyboard "KeyBack" & Web explorers

Post by DjPoke »

Hello

I have a problem with a canvas keyboard released event.
When i hit the "Back" key, in SB, i do some graphical text stuffs, it works.
But, if i upload my program and type its url, the "Back" key shortcut is used by chrome or mozilla to go back on the last url.

Is there a way to by-pass this key conflict ?
(for example in javascript)
My Freewares here :
http://retro-bruno.fr/
Fred
Site Admin
Posts: 1820
Joined: Mon Feb 24, 2014 10:51 am

Re: Canvas keyboard "KeyBack" & Web explorers

Post by Fred »

Yes, there is a way, you can take a look to this for example: https://craig.is/killing/mice

It's planed to add this to SB somewhen !
User avatar
DjPoke
Posts: 22
Joined: Sat Dec 19, 2015 5:27 pm
Location: France (Corsica)
Contact:

Re: Canvas keyboard "KeyBack" & Web explorers

Post by DjPoke »

Thanks.

I've tried to do this :

Code: Select all

; Backspace key
! Mousetrap.bind('backspace', function() {
!     if(v_CursorAtArea > 0) {
!         var l = v_Ar(v_CursorAtArea).text.length();
!         if(l > 0) {
!             v_Ar(v_CursorAtArea).text = v_Ar(v_CursorAtArea).text.substring(0, l - 1);
!         }
!     }
! });
But i'm not sure that i access correctly my structure. In SB, i should use : Ar(CursorAtArea)\text
I've replaced antislash by a dot but is it the correct syntax ?

Code: Select all

Structure Area
  x.i  
  y.i  
  w.i  
  h.i  
  text.s
  type.i ; #TString, #TValue
  align.i ; #ALeft, #ACenter
  auto.i ; #Manual, #Auto1, etc...
EndStructure

Global Dim Ar.Area(#AreasNumber)
EDIT:
This does nothing too : v_Ar(v_CursorAtArea).v_text

EDIT2:
If forgot to import the .js library, and when i import it as a .sb file with the "!" symbol before the JS lines, my program crash.
But finally, i've changed all to not have to use the backspace key out of a stringgadget.
My Freewares here :
http://retro-bruno.fr/
Post Reply