-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 0|420|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=-
SoCoder -> Blogs Home -> Blogs


 
Pio
Created : 17 April 2009
Edited : 01 April 2010
System : Android

MIDlet Pascal and touch screen

here are my latest discoveries

MIDlet Pascal is a small IDE for making simple apps for mobile phones in stripped-down Pascal. It makes Java bytecode [obsolete]and it's free for noncomercial use[/obsolete].

|edit| As weswilliams pointed out, a new version emerged. Midlet Pascal is now free software, hosted at sourceforge.net. |edit|

[obsolete]Last version is from January 2006[/obsolete]. Many features are missing, such as support for touch screens. Here libraries come in. They can be made by you, if you know some Java (explained in MIDlet Pascal help).

The other source of libraries are some Russian language blogs and forums. Some guy Piligrim made many of them, and put some on his blog: piligrim.blog.tut.by, also home of MobileBASIC!

There are many libs on this forum: mobilepascal.ucoz.ru, but you'll have to register (confirm by email etc).
Remember you can use Babelfish or Google translate to translate these sites from Russian!

Finally, if you can find some apps that use that library, you can extract the library from their jar (I think it works).

Then, copy library (.class and .java) to MIDletPascal/Libs folder.

For touchscreen, someone made Lib_sensor library. It can be found on above mentioned forum, or here.

Use

In your programs, call the sensor lib:


Then you get these:
init - initialization procedure. call before using sensor variables
integer pointer_state - 0=pen lifted, 1=pen writing
integer pointer_pressed_x -
integer pointer_pressed_y - coordinates where the pen first touched the screen. they don't reset until it touches the screen again!
integer pointer_dragged_x -
integer pointer_dragged_y - coordinates, when the pen moves over the screen. Not only are they not reset when the pen is lifted, they are also not generated until the pen moves from the spot!
integer pointer_released_x -
integer pointer_released_y - coordinates where the pen was last lifted
integer has_pointer_events - returns 0 or 1
integer has_pointer_motion_events - returns 0 or 1, I think this reports if the device supports dragging (not sure).

Since coordinates do not reset, it is best to make your own variables for pointer coordinates, and reset them when the pointer is pressed, dragged and lifted, otherwise it is hard to know where the pen really is.

Finally, a sample program (roughly translated from www.pirolibrary.narod.ru/LoPC-Midlet.pdf)


 

Comments


Friday, 17 April 2009, 09:12
Jayenkai
Thanks Pio.
I'm still not sure whether I'll end up using the Pascal thing, or just plain Java.
..
Or, you know, not even bothering

But this'll come in handy whichever I choose.
Tuesday, 24 November 2009, 18:02
weswilliams
New news ...
Midlet Pascal is now open source at SourceForge (or will be soon - just exe while we get things sorted). Check it out!