![]() |
![]() |
![]() |
![]() |
NOTE:  Don't confuse this standard IO functionality with the file streaming API. They are unrelated.
StdIOPalm.h. In addition to including this header, you must link the application with the module StdIOPalm.c. This module provides a PilotMain routine that extracts the command line arguments from the cmd and cmdPBP parameters and the glue code necessary for executing the appropriate callbacks supplied by the standard IO provider application.
sioDBType ('sdio') instead of 'appl'. In addition, it must be named "Cmd-cmdname" where cmdname is the name of the command used to execute the application. For example, the ping command would be placed in a database named "Cmd-ping".
SioMain and must accept two parameters: argc and argv. Here's the simplest possible example of a standard IO application.
#include <StdIOPalm.h>Int16 SioMain(UInt16 argc, Char* argv[ ]){ printf("Hello World\n");}cmdPBP parameter of PilotMain.
StdIOProvider.c.
SioInit during application initialization. SioInit saves the object ID of the form that contains the input/output field, the field itself, and the scroll bar.
Call SioHandleEvent from the form's event handler before doing application specific processing of the event. In other words, the form event handler that the application installs with FrmSetEventHandler should call SioHandleEvent before it does anything else with the event.
Call SioFree during application shutdown.
SioInit and SioFree calls. If the current form is not the standard IO form when these calls are made, they will record changes to the active text and display it the next time the form becomes active.
ApplicationHandleEvent, which gets called from its main event loop after SysHandleEvent and MenuHandleEvent. An example is shown in Listing 15.1.
    static Boolean ApplicationHandleEvent (EventPtr event)    {    FormType* frm;    UInt16 formId;    if (event->eType == frmLoadEvent) {    formId = event->data.frmLoad.formID;    frm = FrmInitForm (formId);    FrmSetActiveForm (frm);         switch (formId) {    .....    case myViewWithStdIO:    FrmSetEventHandler (frm, MyViewHandleEvent);    break;    }    return (true);    }     return (false);    }     static Boolean MyViewHandleEvent (EventPtr event)    {    FormType* frm;    Boolean handled = false;    // Let StdIO handler do its thing first.    if (SioHandleEvent(event)) return true;    // If StdIO did not completely handle the event...    if (event->eType == ctlSelectEvent) {     switch (event->data.ctlSelect.controlID) {    case myViewDoneButtonID:    FrmGotoForm (networkFormID);    handled = true;    break;    }    }    else if (event->eType == menuEvent)     return MyMenuDoCommand( event->data.menu.itemID );        else if (event->eType == frmUpdateEvent) {    MyViewDraw( FrmGetActiveForm() );    handled = true;    }    else if (event->eType == frmOpenEvent) {    frm = FrmGetActiveForm();    MyViewInit( frm );    MyViewDraw( frm );    handled = true;    }    else if (event->eType == frmCloseEvent) {    frm = FrmGetActiveForm();    MyViewClose(frm);    }    return (handled);    }
| Standard IO Macros and Functions | |
|---|---|
|
fgetc fgets fprintf fputc fputs getchar gets printf putc |
putchar puts SioAddCommand SioMain sprintf system vfprintf vsprintf |
| Standard IO Provider Functions | |
|---|---|
|
SioClearScreen SioExecCommand SioFree |
SioHandleEvent SioInit |
|   | ![]() |
![]() |
![]() |
![]() |
  |