On Tue, Nov 05, 2002 at 10:08:20AM -0800, Chuck Groom wrote:
> > 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?
Yeah, pgBind is expecting PG_WE_* or PG_NWE_* constants for events, and
you're giving it PGKEY_* constants, that won't work :)
Most widgets don't pass along events like this to the application. You
could do this using buttons with hotkeys, or using a canvas widget, but
that's not what you want probably. What needs to happen is that the
scroll widget get key handlers for arrow keys, and the scrollbox forward
those events to the individual scrollbar(s), just like how scroll wheel
events are handled now. Then if the scrollbox widget was explicitly
focused, you could use key navigation.
The problem here is that if the scrollbox contains interactive widgets
like buttons, the proper way to scroll is to use hotspots to move
between the buttons. IMHO the best way to handle this would be to
add key handlers as described above, then if the scrollbox has no
interactive widgets inside it, the scrollbox itself gets a hotspot.
>
> > 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.
That sounds good.
>
> 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
--
Only you can prevent creeping featurism!
-------------------------------------------------------
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