On Fri, Mar 10, 2000 at 11:24:17AM -0500, John Ioannidis wrote:
> I have an application that prompts the user for some action, then spends 
> about thirty seconds doing public-key-cryptography operations, and then
> responds.  I'd like to have some indication on the screen that the machine
> is not dead, like a moving clockface, or a progress bar, or something.  Does
> anyone have any sample code, or hints, or whatever, that they can send me?

In pilOTP, I have to compute N md4/5/ssh1 hashes; when N is large,
this can take a good number of seconds or a minute or two.   The
computation is triggered by pressing a "Compute" button on the main
form, so what I do as a progress indicator is simply keep the Compute
button inverted until the computation is done.  This is non-animated,
but simple to code and sort gets the idea across that the app is doing
something.  It also works back to PalmOS 1.0 :)

Here's my code:

  switch (event->eType)
    {
    case ctlSelectEvent:  /* A control button was pressed and released. */

      switch (event->data.ctlSelect.controlID)
        {
        case MainComputeButton:
         /* This could get lengthy, so invert button as a wait indicator */
          control = event->data.ctlSelect.pControl ;
          CtlSetValue(control,true) ;
          ...
         /* Do what it sez */
          ComputeOTP() ;
         /* Restore button to normal state */
          CtlSetValue(control,false) ;

John

-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palm.com/devzone/mailinglists.html

Reply via email to