On Thu, Mar 20, 2003 at 12:17:40AM +0300, Michael A. Borisov wrote:
> Dear Mr. Dowty,

No need for the formalness, you can call me Micah :)

> But I have several other questions.
> 
> 1. I would like to create application without panelbar. How I can do it?

There are a few different ways:

 - If you want all the apps you're running to have no panelbar,
   use the "null" app manager instead of the "panel" app manager.

 - If you want one application to have no panelbar, and it's something
   that should always be near an edge of the screen, a Toolbar app
   might be a good choice. Toolbar apps have no panelbar, but their
   layout is handled slightly differently than a normal app- toolbar
   apps are never farther from an edge of the screen than a normal app.

 - If you want the layout to be handled exactly the same, but to disable
   the panelbar, you can manually hide it. Get the panelbar's handle by
   reading the 'panelbar' property of the panel widget, then set the
   panelbar's 'size' property to zero.

> 
> 2. I'm trying to handle events for PG_WIDGET_CANWAS with the help of 
> following code:
> 
> int pg_process_events(struct pgEvent *pg_event)
> {
>  int ch = pg_event->e.kbd.key;
> 
>  if (ch >= 32)
>    printf("process_event %d %c\n", pg_event->type, ch);
>  else
>    printf("process_event %d CTRLSYM\n", pg_event->type);
>  return 0;
> }
> 
> unsigned char *pg_init_driver(unsigned char *param, unsigned char *ignore)
> {
>  pgInit(0, NULL);
>  mPGPanel = pgRegisterApp(PG_APP_NORMAL, "Links", 0);
>  pgSetWidget(mPGPanel, PG_WP_MARGIN, 0, 0);
>  mPGCanvas = pgNewWidget(PG_WIDGET_CANVAS, PG_DERIVE_INSIDE, mPGPanel);
>  pgSetWidget(mPGCanvas, PG_WP_TRIGGERMASK,
>    pgGetWidget(mPGCanvas, PG_WP_TRIGGERMASK) |
>    PG_TRIGGERS_MOUSE | PG_TRIGGERS_KEY,
>    0);
> 
>  mPGGraphicalContext = pgNewCanvasContext(mPGCanvas, PGFX_IMMEDIATE);
>  pgSetLgop(mPGGraphicalContext, PG_LGOP_NONE);
>  pgSetMapping(mPGGraphicalContext, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 
> PG_MAP_NONE);
>  pgSetColor(mPGGraphicalContext, 0);
>  pgBind(mPGCanvas, PGBIND_ANY, &pg_process_events, NULL);
> 
>  return NULL;
> }
> 
> But pg_process_events never prints anything when I'm pressing keys on 
> the keyboard. Maybe PG_WIDGET_CANVAS can not handle events from 
> keyboard? But it is very important for me to handle such events in my 
> application.

The canvas widget can handle keyboard events, but it does not
automatically handle keyboard focus. This is because the canvas should not take
the keyboard focus if it is clicked on and it doesn't need key events.
You can focus the canvas by calling pgFocus(mPGCanvas). You probably want to
do this once right after creating it, and once whenever you get a mouse click.

--Micah

-- 
Only you can prevent creeping featurism!


-------------------------------------------------------
This SF.net email is sponsored by: Tablet PC.  
Does your code think in ink? You could win a Tablet PC. 
Get a free Tablet PC hat just for playing. What are you waiting for? 
http://ads.sourceforge.net/cgi-bin/redirect.pl?micr5043en
_______________________________________________
Pgui-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/pgui-devel

Reply via email to