Fax Sending: 1 Destination Phone Number

Up: GEOS SDK TechDocs| Up | Prev: Fax Sending | Next: 2 Drawing the Contents

To prompt the user for the fax's destination phone number while employing the device's standard look and feel, we will use the Mailbox library and its fax adjuncts. Specifically, we will use a MailboxSendControl object, configured for use with fax.

Make sure the following lines appear in the application's .gp file:

library mailbox   # Defines MailboxSendControlClass
library spool     # Defines PrintControlClass

We will use a MailboxSendControl object to provide the UI that prompts the user for a phone number. When it comes time to draw the contents of our fax, we'll also need a PrintControl object.

We make sure that these controller objects are added to the correct GCN lists in the declaration of our application's Application object:

Code Display 4-1 Adding the Fax Controls to the Proper GCN Lists

In the declaration of the application's Application object, we make sure that the MailboxSendControl and PrintControl objects are placed on the proper GCN lists.

@object ... MyApp = {
    ...
    gcnList(MANUFACTURER_ID_GEOWORKS, GAGCNLT_SELF_LOAD_OPTIONS) =
				... @MyPrintControl, @MySendControl;
    gcnList(MANUFACTURER_ID_GEOWORKS, MGCNLT_ACTIVE_LIST) = ... @MySendControl;
    gcnList(MANUFACTURER_ID_GEOWORKS, GAGCNLT_MAILBOX_SEND_CONTROL) =
							... @MySendControl;
    ATTR_GEN_APPLICATION_PRINT_CONTROL = @MyPrintControl;
}

We make sure that the MailboxSendControl will be visible to the user; the straightforward way to do this is to add it to the application's generic UI tree. For example:

@object GenPrimaryClass MyPrimary = {
    GI_comp  = ..., @MySendControl;
}

Finally, we're ready to declare the MailboxSendControl object itself:

Code Display 4-2 MailboxSendControl Object Ready for Fax

@object MailboxSendControlClass MySendControl = {
    GI_visMoniker = "Send";
    GII_visibility = GIV_POPUP;
    GCI_output = process;
    MSCI_defBodyType = MOT_SELECTION;
    ATTR_MAILBOX_SEND_CONTROL_SEND_SELECTION;
    ATTR_GEN_INIT_FILE_CATEGORY = "fax" ;
    ATTR_MAILBOX_SEND_CONTROL_SINGLE_TRANSPORT = {
    {GMID_CELL_MODEM, MANUFACTURER_ID_GEOWORKS},
    {GMTID_FAX_SEND, MANUFACTURER_ID_GEOWORKS},0};
    ATTR_MAILBOX_SEND_CONTROL_TRANSPORT_HINT_OPTR =  {
      {GMTID_FAX_SEND, MANUFACTURER_ID_GEOWORKS}, 0,
      @MyPrintControl};
}

(If your application is to run on the Nokia 9000i Communicator, use ComplexMonikerClass to give your MailboxSendControl the standard Nokia 9000i Communicator look and feel. In the example above, you would replace

@object MailboxSendControlClass MySendControl = {
    GI_visMoniker = "Send";

...with...

@object ComplexMonikerClass MySendControl = {
    ComplexMoniker = MailboxSendControlClass;
    CMI_topText = CMT_SELECT_RECEIVER;
    HINT_SEEK_REPLY_BAR; /* make this button 0 */
    HINT_SEEK_SLOT = 0;

)

ATTR_MAILBOX_SEND_CONTROL_TRANSPORT_HINT_OPTR tells the MailboxSendControl that when it comes time to send a fax, it should look to the MyPrintControl object to provide the data. The FaxSendTD Mailbox transport driver knows how to interact with PrintControl objects; we will add code to our program to work with the PrintControl to draw our fax contents.

ATTR_GEN_INIT_FILE_CATEGORY tells the send control where to find the user's faxing preferences within the INI file--the "fax" category.

ATTR_MAILBOX_SEND_CONTROL_SINGLE_TRANSPORT specifies that this MailboxSendControl only sends data by fax. To allow your application to send data in additional ways, get rid of this ATTR.

The MailboxSendControl would ask the user what data they wish to send: the current selection, current page, all pages. In most fax programs, we don't want to give the user that choice. In our example, we use the ATTR_MAILBOX_SEND_CONTROL_SEND_SELECTION vardata field to prevent the controller from presenting the user with this choice--the MailboxSendControl will always try to send the "current selection," though our program ignores any idea of selection.


Up: GEOS SDK TechDocs| Up | Prev: Fax Sending | Next: 2 Drawing the Contents