Restoring full phone screen after keypad

Started by om963, March 08, 2024, 19:28:04

Previous topic - Next topic

om963

Is there a way to to get back the use of the full phone screen after using keypad? Hidekeypad() hides the keypad but you can't print in the area where the keypad was. Using the phone icon for hiding will get it back but it is a bit awkward method.

J7M

I tested with standard google keyboard and with hackers keyboard. In both cases I have to wait after calling hidekeyboard() around 200ms. if I draw without waiting, I can't draw where the keyboard was.

My test program:
w = window()
w.showkeypad()
rect 0,0,4000,4000, 11 filled
print "Press a key"
pause
w.hidekeypad()
delay 200
rect 0,0,4000,4000, 12 filled

Does it help or is in your case drawing to this region block forever?

Pakz

I asked that new LLM. Claude 3 Opus.

No idea if the output is helpful  :-\


Claude 3: 

Certainly! In Small Basic, you can use the `GraphicsWindow` object to manipulate the graphics window and restore the full screen after using the keypad.

Here's an example of how you can achieve this in Small Basic:

```small_basic
' Your code that uses the keypad goes here

' Save the current graphics window state
gw_width = GraphicsWindow.Width
gw_height = GraphicsWindow.Height
gw_title = GraphicsWindow.Title
gw_background = GraphicsWindow.BackgroundColor

' Clear the graphics window to remove the keypad
GraphicsWindow.Clear()

' Restore the graphics window state
GraphicsWindow.Width = gw_width
GraphicsWindow.Height = gw_height
GraphicsWindow.Title = gw_title
GraphicsWindow.BackgroundColor = gw_background

' Your code to redraw the screen content goes here
```

In this example:

1. After you have finished using the keypad, save the current state of the graphics window by storing the values of `GraphicsWindow.Width`, `GraphicsWindow.Height`, `GraphicsWindow.Title`, and `GraphicsWindow.BackgroundColor` in separate variables.

2. Clear the graphics window using `GraphicsWindow.Clear()` to remove the keypad.

3. Restore the graphics window state by setting the properties of `GraphicsWindow` back to their original values using the variables you saved earlier.

4. After restoring the graphics window state, you can redraw the screen content as needed.

By following these steps, you can effectively restore the full screen after using the keypad in Small Basic.

Note that this approach assumes that you have saved any necessary information or state before clearing the graphics window. If you need to redraw specific elements or content on the screen, you'll need to include the appropriate code to do so after restoring the graphics window state.

om963

Haven't tested the GraphicsWindow, but the delay seems to do the trick. Thanks a lot!

chrisws

You need to tell Claude-3 you mean the GPL version of SmallBASIC - or not... it kind of hallucinates the answer lol