Neatware  Header

Cards

This procedure will navigate a list of cards in cycle. ls is the list of card's content. Current card id is card_n. m is the number of elements in the ls.

public void Navigation(String[] ls)
{
  m = ls.length;
  for {n=0; n

'accept' key refers to prev card. The previous card id is the (n-1)%m.

      _do( "type='accept' label='Prev'" );
        __go( "href='#card_" + Integer.toString((n-1)%m) + "'" );
      do_	();

'option' key refers to next card. The next card id is the (n+1)%m.

      _do( "type='options' label='Next'" );
        __go( "href='#card_" + Integer.toString((n+1)%m) + "'" );
      do_	();

display current card. _b_ is the inline command of bold. lindex gets the nth item from the ls.

      _p( "align='center'" );
        quote( " Card" + Integer.toString(n)
             + " of" + Integer.toString(m) );
        __br(); __br();
        quote( ls[n] );
      p_();
    card_();
  }
}  

output wml page to file cards.wml. __pi specifies the header of XML. __doctype specifies the standard wml DTD file.

wmlHeader();

set ls with the initial elements.

String[] ls = {"Let's start!",
  "Where is the Rocky Mountain?",
  "Right answer!"};

call Navigation proc with ls.

_wml();
  Navigation( ls );
wml_();
Next > Template