Missing chars on Canvas #PB_EventType_Input

Just starting out? Need help? Post your questions and find answers here.
Dirk Geppert
Posts: 284
Joined: Fri Sep 22, 2017 7:02 am

Missing chars on Canvas #PB_EventType_Input

Post by Dirk Geppert »

I have tried to capture keyboard input via an activated CanvasGadget().
It works fine with single letters, but when I receive a longer stream of letters via a BarCode scanner, only the first 8 characters are received.

Is this a browser limitation?

Code: Select all

OpenWindow(0, 0, 0, 220, 220, "Canvas container example", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  
CanvasGadget(0, 10, 10, 200, 200, #PB_Canvas_Keyboard | #PB_Canvas_DrawFocus )

Procedure SetFocusToCanvas()
  SetActiveGadget(0)
  RemoveWindowTimer(0, 0)
  UnbindEvent(#PB_Event_Timer, @SetFocusToCanvas())
  Debug "SetActiveGadget() done. Ok?"
EndProcedure

Procedure GadgetEvents()
  Static s.s
  
  Select EventGadget() 
    Case 0
      Select EventType() 
        Case #PB_EventType_Input 
          s + Chr(GetGadgetAttribute(0, #PB_Canvas_Input))
          Debug s
          
        Case #PB_EventType_LostFocus
          Debug "Focus Lost"
          AddWindowTimer(0, 0, 2000)
          BindEvent(#PB_Event_Timer, @SetFocusToCanvas())
      EndSelect
      
    EndSelect
  
EndProcedure

BindEvent(#PB_Event_Gadget, @GadgetEvents())
SetActiveGadget(0)