The droidwd addon is a wd (window driver) emulator using Android java api. It allows running legacy J6 gui code on Android devices. Since this emulator is implemented using some already deprecated api, so that do not depend on it to write production applications.
First add a require before running any wd commands.
DO NOT use load
load 'droidwd' NB. never use 'load' unless you are debugging droidwd itself.
Sometimes it also needs to load a related addon wdclass provides several utility classes such as jisigraph and jview.
require 'droidwd wdclass'
J602's base library since 6.02.066 will ignore droidwd and wdclass for load or require. In addition, gtkwd will be ignored on Android and droidwd will be ignored on desktops, so it is harmless to include a require 'droidwd gtkwd' if you want the script to run under both J602 and J701 jgtk and Android.
Each form should be contained inside its own class and that class must coinsert the class wdbase. Execute the verb start_droidwd with an argument of the class or object locale to start the app. wd commands for creating form will be run via droidwd_run. This can be summarized as below
require 'droidwd' NB. or 'droidwd wdclass' if jisigraph or jview is needed coclass 'foo. coinsert. 'wdbase' droidwd_run=: run ... run=: 3 : 0 wd 'pc form;pn "hello"' .... ) ... start_droidwd 'foo' NB. start_droidwd '' is OK if this line is inside the same class, foo
The following is a simple but complete example showing how to use this wd emulator.
require 'droidwd' coclass 'reverse' coinsert 'wdbase' droidwd_run=: run REVERSE=: 0 : 0 pc reverse; pn reverse; xywh 10 10 80 10; cc e edit; xywh 10 30 40 10; cc b button; cn reverse; ) run=: 3 : 0 wd REVERSE wd 'set e "hello j"' ) reverse_b_button=: 3 : 0 wd 'set e *', |.e ) start_droidwd '' NB, automatically run after loading
The prologue (first 4 lines) is new, the rest is a typical j602 gui program.
To run from outside after loading the script, omit the last sentence and run it with
- each activity only allows 1 parent form, and it will occupy the whole screen, in other wrods, no overlapping windows.
- positions and sizes of widgets will be overrided by Android layout manager.
- position and size from wd'qformx' does not include window border and title bar.
- although gl2 commands can be used outside the paint event, the actual drawing will only be displayed inside the paint event.
- glpaintx from J504 is re-introduced, but do not run glpaintx inside a paint event, otherwise there will be an infinite loop.
- container for subforms must be a tab control.
- radio button group is arranged vertically, or horizontally is the first radio button has the bs_lefttext style.
- mb dialog box is non-modal and results in the callback form_alertdialog with sysdata containing the position of button pressed.
- similarly, mbquery, mbopen and mbsave do not work.
- pc command supports 2 new styles - scroll and hscroll. A parent form with them can scroll vertically or horizontally so that the actual can be larger than the physical screen. Note that it can not contain any listbox or the listbox can not scroll. This is a feature Android UI.
- isigraph supports 2 new styles - image and web. The content can be set with the set command as follows.
require 'droidwd' coclass 'exten' coinsert 'wdbase' droidwd_run=: run EXTEN=: 0 : 0 pc exten scroll; pn exten; xywh 0 0 150 150; cc g1 isigraph image; xywh 0 150 150 150; cc g2 isigraph web; ) run=: 3 : 0 wd EXTEN wd 'set g1 *', 1!:1 < jpath '~bin/icons/favicon.ico' NB. image wd 'set g2 *http://www.jsoftware.com' NB. URL of webpage NB. wd 'set g2 *', '<html> .... </html>' NB. source of webpage ) start_droidwd 'exten'
- Microsoft windows features such as oleautomation, ocx, emf, richedit will not be implemented.
Un-implemented wd Commands
The following commands are not or will not be implemented.
- session manager not supported
smcolor smkeywords smsetlog sminputlog
- ole commands not supported
oleget olegetlic oleinfo oledlg oleenable oleid oleload olemethod olemethodx oleocx olerelease olesave oleset olesetlic
- most parent commands
pactive pas pcenter picon pmove pmoves psel pshow ptop
- un-implemented child classes
groupbox scrollbar scrollbarv spin spinv static trackbarv
- other ignored commands
qhinst qhwndx qkeystate qrtf mbcolor mbfont mbopen mbprinter mbsave clipcopyx clippastex msgs pcolor security setbkgnd setcolor setcolwidth setpclip setupdate settabstops tnomsgs wait setdelete setedit setfocus setinsert setlimit setmodified setreadonly setreplace setscroll setselect
Un-implemented gl2 Commands
The following commands are not implemented.
glcapture glclip glclipreset glcaret glcursor glemfclose glemfopen glemfplay glfile glroundr glwindoworg
Demos are available in addons
All of the above demos can be run from demos/wd.
Obviously, droidwd requires gui/android for working. It also depends on the addon graphics/gl2 for isigraph and gl2 functions.
Please report bugs with information such as Android version and testing devices. Provide a simple script to reproduce the bug if applicable.
Contributed by Bill Lam