> 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 ?

I'd guess that the scrollbox is not getting keyboard focus, so doesn't
receive the key events. Have you verified that mvUp is getting called?

> 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

This is a common problem. ;) Most widget sets allow SHIFT+TAB to move
_backwards_ out of a text widget. I think that, yes, a text widget
should allow focus to move when the user moves the cursor past the start
or end of the text, but this is should be optional. Moreover, the widget
should emit a signal that an interested application could bind to such
that focus could be moved explicity.

My two cents,

Chuck


-------------------------------------------------------
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