Codesnippets > Code Snippets

IMPUT$ (input$ in any device!)

(1/4) > >>

ampos:
This functions is the same as INPUT$ but it opens a virtual keyboard if target device has no keyboard.

Just call it as


--- Code: (glbasic) ---t$=imput$(Text$,x,y)
--- End code ---

Where "text" is a text :) to be displayed behind the input cursor.

At run, it asumes the device has keyboard and a "standard" input cursor is displayed. If the user touchs the screen, it now thinks you have no keyboard and a virtual keyboard is shown in screen. Now you can type using mouse/toouchscreen and keyboard.

It has been tested with Android (no keyboard) and Pre2 (keyboard) and it works great. Too lazy for iOS with/out bluetooth keyboard.

Due to my current development method, it has been created for a virtual screen enviroment.

You have to create a 1024x640 (16:10 aspect) screen 1 with sprite id "my_screen". This screen will be scaled and drawn to fit (with aspect ratio locked) the current screen (it has been tested on 480x320, 1024x768, 800x480 and looks great!).

The keyboard creates a virtual screen 2 with sprite id keyb_keyboard, but is not needed anything by the user.

Also virtual screen 3 sprite id keyb_input is created for the input text zone (this has been aded a few minutes ago and has not been tested a lot).

Also the demo has a few working buttons created with ZONES library, so this demo is for ZONES lib, IMPUT$() and SCALE  =D

The whole libe has been updated to use gensprite() and genfont() so you dont have to worry more about sprites IDs. Notice you still have to create a virtual screen ID 1 as your main drawing screen. Virtual screens 2 and 3 are also created and discarded after use.

Keyboard zones are moved from 1-44 to 10001-10044, so it is unlikely they will overwrite your current zones.

Now the keyboard is hidden if the user click outside the keyboard. Much cooler now! :)



[attachment deleted by admin]

Kitty Hello:
please fix it to use GENSPRITE instead. It's easier to "plug into" an existing project, then.

[edit]
AWESOME WORK!

ampos:
Oh, I see. I will rewrite it tonite. Stay tuned!  =D

Minion:
Its nice, I like it. But I have a problem with the space entry. Each time I click the space buttone it changes case, so if I enter 2 or more spaces it goes Upeper, then lower then upper then lower etc case.

ampos:
It is because I use it to write names of persons.

Just remove completly the cases 39 and 40.

I have just noted that this auto-case is not working in phisical keyboard :)

Navigation

[0] Message Index

[#] Next page

Go to full version