IMPUT$ (input$ in any device!)

Previous topic - Next topic

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) Select
t$=imput$(Text$,x,y)

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]
check my web and/or my blog :D
http://diniplay.blogspot.com (devblog)
http://www.ampostata.org
http://ampostata.blogspot.com
I own PC-Win, MacBook 13", iPhone 3G/3GS/4G and iPAC-WinCE

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
check my web and/or my blog :D
http://diniplay.blogspot.com (devblog)
http://www.ampostata.org
http://ampostata.blogspot.com
I own PC-Win, MacBook 13", iPhone 3G/3GS/4G and iPAC-WinCE

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 :)
check my web and/or my blog :D
http://diniplay.blogspot.com (devblog)
http://www.ampostata.org
http://ampostata.blogspot.com
I own PC-Win, MacBook 13", iPhone 3G/3GS/4G and iPAC-WinCE

msx


Nathan

Superb work there.   :good:

Albert

I like it. Should be add a Hide Keyboard button (or hide it if touch outside the keyboard)

ampos

Quote from: Albert on 2011-Sep-19
I like it. Should be add a Hide Keyboard button (or hide it if touch outside the keyboard)

Not bad idea to hide it.

It will be done.
check my web and/or my blog :D
http://diniplay.blogspot.com (devblog)
http://www.ampostata.org
http://ampostata.blogspot.com
I own PC-Win, MacBook 13", iPhone 3G/3GS/4G and iPAC-WinCE

bigsofty

This looks really good, well done!  =D
Cheers,

Ian.

"It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration."
(E. W. Dijkstra)

blackway

Ampos, It's great !!!!!!
Thanks for share !!
I'll use it in my next game!  :good:
Cheers,

ampos

Updated to use gensprite() and genfont() so they can be included in your proyect more easily.

Also it has been updated to hide the keyboard if the user clicks outside the virtual keyboard. Much cooler now!

:booze:
check my web and/or my blog :D
http://diniplay.blogspot.com (devblog)
http://www.ampostata.org
http://ampostata.blogspot.com
I own PC-Win, MacBook 13", iPhone 3G/3GS/4G and iPAC-WinCE

Hatonastick

I love how this looks on my PC, however I can't get it to work properly on either of my Android devices.  It compiles, installs and runs.  However when you run the example the font is _tiny_.  At a guess I'd say around 2x2 pixels on the screen and it doesn't seem to matter whether I compile it for my phone (3" screen) or tablet (7" screen).  I've tried all sorts of changes but nothing seems to really impact on the size.  Both the 'small' font and the 'large' font seem to display as being the same size ie. tiny.  I'm guessing there's a scaling issue somewhere but I haven't spotted it thus far.

Has anyone had any luck getting this to work properly under Android?  I'd really like to use it. :)
Mat. 5: 14 - 16

Android: Toshiba Thrive Tablet (3.2), Samsung Galaxy Tab 2 (4.1.2).
Netbook: Samsung N150+ Netbook (Win 7 32-bit + Ubuntu 11.10).
Desktop: Intel i5 Desktop with NVIDIA GeForce GTX 460 (Win 8.1 64-bit).

Mikele

#13
Quote from: Hatonastick on 2011-Nov-01
[...]

Has anyone had any luck getting this to work properly under Android?  I'd really like to use it. :)

Hey, I had same problem. Try to change:

mpat$=GETCURRENTDIR$()+"media/"


to

mpat$="Media/"

In my case it does work.

M.

[EDIT] It's a "case sensitive" problem. I've changed line mpat$=GETCURRENTDIR$()+"Media/"  ("media" changed to "Media") and it does job as should.

Hatonastick

Whoops, yeah I somehow missed that bit.  You are right, that's all that needs to be changed and then it works perfectly.  :good:

Thanks!
Mat. 5: 14 - 16

Android: Toshiba Thrive Tablet (3.2), Samsung Galaxy Tab 2 (4.1.2).
Netbook: Samsung N150+ Netbook (Win 7 32-bit + Ubuntu 11.10).
Desktop: Intel i5 Desktop with NVIDIA GeForce GTX 460 (Win 8.1 64-bit).