GLBasic forum

Main forum => GLBasic - en => Topic started by: Kitty Hello on 2008-Oct-15

Title: onscreen keyboard for DDgui
Post by: Kitty Hello on 2008-Oct-15
Hi,

it's time for me to ask a question now ;)

Anyone, who played with DDgui, I improved speed a lot and it's running nicely on a PocketPC now. The problem is - input.
So, I made a DDguiDialog that can edit a text:

(http://img395.imageshack.us/img395/8592/unbenanntpaint6pngjr6.th.png) (http://img395.imageshack.us/my.php?image=unbenanntpaint6pngjr6.png)(http://img395.imageshack.us/images/thpix.gif) (http://g.imageshack.us/thpix.php)

The editor is 240x240, perfect fr PocketPC and GP2X/WIZ.
The question now is - how to implement this dialog within the DDgui module, so you can edit any DDGui_text's contents by "clicking" it - or so...
Is my question clear?
How to open the dialog, and where to click to do it?

Thank you.



Title: Re: onscreen keyboard for DDgui
Post by: trucidare on 2008-Oct-15
ON_EVENT(click)
   IF txt_box <> readonly
      OSK_Show(txt_box)
   ENDIF
Title: Re: onscreen keyboard for DDgui
Post by: Kitty Hello on 2008-Oct-15
readonly - interessanting idea.
Title: Re: onscreen keyboard for DDgui
Post by: Moru on 2008-Oct-15
Agh, don't tell me I need to redo the proportional font implementation...ahwell it wasn't working perfectly with edit boxes anyway...
Title: Re: onscreen keyboard for DDgui
Post by: Kitty Hello on 2008-Oct-16
Was not? :D
I will have a look and implement it optionally, OK?
Title: Re: onscreen keyboard for DDgui
Post by: Kitty Hello on 2008-Oct-16
(http://img442.imageshack.us/img442/6962/snippingtool185pngfe2.th.png) (http://img442.imageshack.us/my.php?image=snippingtool185pngfe2.png)

It's working great, and I got the kerning in the whole DDgui, now (Just one function you call to create a kerning width table).
I will have to work on it, because switching from abc to ABC takes quite a while on the PocketPC.
Typing is reasonably fast, so no problems here.
I introduces the READONLY flag for a text, and auto-DDGui_input$'ed editable texts for GP2X and PocketPC.

I know very few have used DDgui so far, but it's one of my most useful projects, ever. I really encourage you to try it, if you need any sort of GUI within a window.

V6 will probably feature a native-skinned GUI with Tcl/Tk, but this is a LOT of overhead for small projects. Also, DDgui is much easier to use. It's much more "GLBasic" than native GUIs, because it's not requiring any "callback" or "messaging" functionality.



Title: Re: onscreen keyboard for DDgui
Post by: Moru on 2008-Oct-16
It's realy nice to use with proportional spacing, easy to make options for your programs. I'm using it for some simple dialogs with input in Scribble.

But there is some need for some more documentation I think. Specific examples for each function, not a finnished program. This is how you get a text string, what the parameters are for and so on, needed some trial and error to get that working.
Title: Re: onscreen keyboard for DDgui
Post by: Kitty Hello on 2008-Oct-16
Really!?
What part was hard to understand? I thought the documentation at the top of the file is extensive.
Title: Re: onscreen keyboard for DDgui
Post by: MrTAToad on 2008-Oct-16
Would it be possible to add the ability for text boxes to accept up to X number of characters - I need that for my game :)

If possible, a bit more control over where entities could go would be nice too - as I mentioned previously, it would have been nice to be able to put in buttons vertically to the right of a list box. 

A window with a title, but unable to move would be handy too

Title: Re: onscreen keyboard for DDgui
Post by: Hemlos on 2008-Oct-16
Quote from: MrTAToad on 2008-Oct-16
Would it be possible to add the ability for text boxes to accept up to X number of characters - I need that for my game :)


Funny you should ask, i made this function about a week ago...i use it for all my text input$ lately.
Its a goal oriented inkey$(), to limit size of input, and pass data, when enter is pressed.
It works similiar to the good old BASIC input$, with a twist...It limits the length of the input.

Maybe you can incorporate this function, into DDGui?


If you need a window with it..just use drawrects?
Code (main body) Select

Print "Write Name(MAX: 10 characters): "+HText$,10,10
if Hemlos_INPUT$(HText$,10) //if enter pressed
   NewMsg$=HText$ //pass data
   HText$="" //clear input
endif
Print "Your Name is: "+NewMsg$,10,30




Code (function) Select

FUNCTION Hemlos_INPUT$: BYREF HText$, SizeLimiter
//Limit size LEN(HText$) of input=SizeLimiter
// if return = false then Enter not pressed yet
// if return = true then Enter Pressed
LOCAL InText$
InText$=INKEY$()
IF LEN(HText$)>SizeLimiter THEN InText$="\b" //limit the length of input, auto backspace
SELECT InText$ //read the input
CASE "\n" //enter is pressed
IF SizeLimiter>0
IF LEN(HText$)=0 THEN RETURN FALSE
ENDIF
RETURN TRUE // good - finished, send goal
CASE "\b" //backspaced
HText$=MID$(HText$,0,LEN(HText$)-1)
RETURN FALSE
DEFAULT //character added to input byref
HText$=HText$+InText$
RETURN FALSE
ENDSELECT
ENDFUNCTION


Perhaps you can change it too or add another function to go with it to scroll if the limit is reached allowing for long inputs with only sizelimit characters showing :)
This way you can fit it in a presized "input window", like the way you can input a URL into a web browser where it scrolls off to the right, you can do this with mid$

Title: Re: onscreen keyboard for DDgui
Post by: Moru on 2008-Oct-16
DDGui already does the scrolling and so on, all you need to do is limit the number of characters possible to input.
Title: Re: onscreen keyboard for DDgui
Post by: Kitty Hello on 2008-Oct-20
Yes, next version of DDgui is a complete renewal. Much faster and better to debug.
It includes the above keyboard, for PocketPC/GP2X. Very useful.
Also, tooltips.