PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

GapiDraw and cross platform text input

Thomas Sempf · 09 Feb 2005, 16:14 UTC
Hello,

At the moment I am trying to implement text input in my application, which should run on Symbian, PocketPC/Smartphone, and Palm. I encounter several problems:

- On PocketPC it isn't possible to use the soft keyboard, because GapiDraw will over paint it with every call to flip (here it would be nice to specify which area to flip, so the soft keyboard won't be over-painted). There is a solution in displaying your own keyboard bmp, but if you want the application to be used international, you would need Unicode support, that means the Japanese version needs Japanese characters, so it would be nice to just use the OS, cause it has already the right keyboard characters.
- on Smartphones its getting even harder with the text input, cause we don't have a soft keyboard and we must use some kind of text input system (i.e. t9).

Are there any solutions for those problems? Can GapiDraw somehow altered to use the underlying OS functionality for text input?
InexorableTash · 11 Feb 2005, 00:19 UTC
When doing text input you might want to switch from fullscreen (GAPI-based) GapiDraw to windowed (GDI-based). Then you just write a normal Windows Mobile app so far as the SIP is concerned. Asking GAPI to only Flip part of the screen is asking for problems - how big is the SIP, how is Flip implemented on various devices, etc.

And then there is the issue of actually having a text entry panel - I haven't done any SmartPhone programming but rather than trying to recreate the capabilities of a text editor you could create an invisible (offscreen, etc) Edit control and have focus there, and shadow the display of the edit control into the GapiDraw surface (e.g. ask for the text & caret position, rely on notifications to update, etc)

Out of curiosity, how were you planning to handle character rendering? (A GDI font rendering function in GapiDraw would be a handy thing to have around.)
Thomas Sempf · 14 Feb 2005, 08:32 UTC
For the character rendering we planned to use GDI functions like DrawText, but I haven't tested yet if it works or not. Text drawing is really a problem at the moment with GapiDraw, because you can't even use the GD DrawText function under Symbian and Win32/PocketPC the same way, due to the fact that _TCHAR is defined as char under Symbain and as wchar under Win32 (the is also true for pathes you use for creating surfaces). So, you have to convert all strings under Symbian from Unicode to ASCII before calling DrawText or CreateSurface. A little bit annoying. Some more advance text rendering support would be warmly welcome; otherwise GD is really nice framework for all kind of programs.
So, you have to convert all strings under Symbian from Unicode to ASCII before calling DrawText or CreateSurface.


Why can't you simply store your strings in _TCHAR format? The char / wchar issue you describe is the same for cross-platform Windows XP / Windows Mobile development, and is not GapiDraw-specific.
Thomas Sempf · 14 Feb 2005, 11:00 UTC
Well, WinXP and Windows Mobile work with _TCHAR defined as wchar (and also GapiDraw is handling that right, so I can make calls to CreateSurface with wide char). The problem is that in my application every string is handled as Unicode (also low-level device access to the file systems works on Unicode), and I have one project for Symbian and Win32/PocketPC, that means I have to convert on Symbian to char (which isn't so nice). Symbian supports Unicode, so there shouldn't be a problem to use _TCHAR on Symbian as wide char.

BTW, I tried to render with Win32 GDI DrawText functions into the GapiDraw screen and it works. You can get the dc directly from the GapiDraw surface.