Hi Micah, hi everybody,

I have some questions about navigation and scrolling..

1) how could we manage scrolling of a 'read only' text widget
   with only help of a keyboard ?

  I thought about using something like this:

------8<----------------------------------
...

static int currentPos;
static int step;
...

int mvUp (struct pgEvent *evt)
{
  if (! currentPos) {
    currentPos = pgGetWidget (evt->from, PG_WP_VALUE);
  }
  currentPos  += step;
  pgSetWidget (evt->from, PG_WP_VALUE, currentPos);
}
int mvDown (struct pgEvent *evt)
{
  if (! currentPos) {
    currentPos = pgGetWidget (evt->from, PG_WP_VALUE);
  }
  currentPos -= step;
  pgSetWidget (evt->from, PG_WP_VALUE, currentPos);
}

int main (int argc, char ** argv) {
  pghandle title;
  pghandle scrollbox;

  pgInit (argc, argv);
  wApp = pgRegisterApp (PG_APP_NORMAL, APPTITLE, 0);

...

  scrollbox = pgNewWidget (PG_WIDGET_SCROLLBOX, PG_DERIVE_INSIDE, wApp);
  wText = pgNewWidget (PG_WIDGET_TEXTBOX, PG_DERIVE_INSIDE, 0);
  pgSetWidget (PGDEFAULT,
               PG_WP_SIDE, PG_S_ALL,
               PG_WP_TEXT, pgNewString ("1\n\n2\n\n3\n\n4\n\n"
                                        "5\n\n6\n\n7\n\n8\n\n"
                                        "9\n\n10\n\n11\n\n12\n\n"),
               PG_WP_READONLY, 1,
               0);
   
  pgBind (scrollbox, PGKEY_UP, mvUp, 0);
  pgBind (scrollbox, PGKEY_DOWN, mvDown, 0);

...
}
----------8<------------------------------

which dosen't work.

Scrolling when the widget is editable is not a problem as this is
done with help of the cursor's scrolling. But when the widget as
no cursor (read only), it becom unscrollable :(
Or maybe I didn't use the right still existing methode ?


2) How getting out of a text widget (with keyboard input) ?

When you are in a text edit widget, the arrow keys are used to move
the cursor through the text and the tab key insert a .. tab.
There is then no way to get out of the widget w/o another input
device such like a touchpad or a mouse.
One idea could be the following (based on symbian navigation):

* when the cursor is on the first/last line, the up/down key
  will get out of the widget selecting the following widget
  regarding the key

* for line input widget (textbox PG_WP_MULTILINE=0) this behavior
  could be extended to first/last cursor position with left/right keys

What about this ?
-philippe


-------------------------------------------------------
This sf.net email is sponsored by: See the NEW Palm 
Tungsten T handheld. Power & Color in a compact size!
http://ads.sourceforge.net/cgi-bin/redirect.pl?palm0001en
_______________________________________________
Pgui-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/pgui-devel

Reply via email to