Text input on the smartphone does not work

Just starting out? Need help? Post your questions and find answers here.
Stefan
Posts: 160
Joined: Mon Feb 05, 2018 9:44 pm

Text input on the smartphone does not work

Post by Stefan »

Text input on the smartphone does not work
With the following code, text entry with smartphones does not work. Or at least very often not.
Whenever you click on the input field, the mobile phone keypad comes on briefly, but disappears again immediately.
It would always work if the text entry box was over the cell phone keyboard, but of course this is a bit inconvenient.
What am I doing wrong?
It should work on a browser.

You can test it here:
http://www.doko-lounge.de/chattest.html

And here is the code:

Code: Select all

EnableExplicit

Global xres,yres,browser.s,smartphoneflg


Declare.s GetBrowserName()
Declare DesktopFeststellen()
Declare Eingabefenster()


Enumeration
  #testwindow
  #chatbox
  #chateingabe
  #chatsendenbutton
EndEnumeration





browser=GetBrowserName()
Debug browser
If FindString(LCase(browser),"mobile")>0
  smartphoneflg=1  
EndIf

DesktopFeststellen()
Eingabefenster()


Procedure.s GetBrowserName()
  ! return platform.name;
EndProcedure



Procedure DesktopFeststellen()
  
  Protected  width,height,wd ,teiler.f,zoom
  Protected.s browser
  
  !document.body.style.zoom = 1 / window.devicePixelRatio * 100 + "%"
  !v_width=document.body.clientWidth;
  !v_height=document.body.clientHeight;
  !v_r=window.devicePixelRatio
  
  Teiler=height/400
   If smartphoneflg=1 ;Smartphone
    If teiler>1
      !document.body.style.zoom = v_teiler / window.devicePixelRatio * 100 + "%"
    Else
      !document.body.style.zoom = 1 / window.devicePixelRatio * 100 + "%"
    EndIf
    !v_width=document.body.clientWidth;
    !v_height=document.body.clientHeight;
    
  EndIf
  
  xres=width
  yres=height
  
  
  
EndProcedure



Procedure Eingabefenster()
  
  Protected ChatHeight,c,ChatBreite,x,y,w,h
  OpenWindow(#TestWindow, 0, 0, xres,yres, "",#PB_Window_BorderLess)
  AddKeyboardShortcut(#TestWindow, #PB_Shortcut_Return, 2)
  chatbreite=200
  chatheight=yres-200
  
  x=10
  y=10
  TextGadget(#chatbox,x,y,ChatBreite,chatheight,"",#PB_Text_Border)
  
  
  
  x=GadgetX(#chatbox)
  y=GadgetY(#chatbox)+GadgetHeight(#chatbox)+20
   y=GadgetY(#chatbox):  h=GadgetHeight(#chatbox)
  ;Chateingabe
  StringGadget(#ChatEingabe, x, y+chatheight+10, GadgetWidth(#chatbox)-80, 30, "")
  x=GadgetX(#ChatEingabe)+GadgetWidth(#ChatEingabe)+5
  y=GadgetY(#ChatEingabe)
  ButtonGadget(#ChatSendenButton,x,y,60,30,"Senden")
   
EndProcedure