I am having problems with the screen not redrawing automatically in
certain situations and I'm not sure if it is me misusing the api or a
bug.

When I have several different possible screens that I want an app to
draw I tend to have each one drawn with a function that starts and
ends with a pgEnterContext() and pgLeaveContext(), and has its own
pgEventLoop(). pgExitEventLoop() then appears in one of the button
handlers to return us to the main app loop.

For some reason the second time one of these functions is called I end
up with a blank screen. Resizing the window on the panel triggers a
redraw. The only way I have found around this is to do a pgUpdate()
after leaving the context, but the docs suggest this shouldn't be
necessary. Am I doing this wrong or is there a bug here.

Code sample to reproduce this follows - just click on the redraw
button to get a blank screen.

Regards,
James

#include <picogui.h>

static int btnRedraw(struct pgEvent *evt);
static pghandle wPanel;

int main(int argc, char *argv[])
{
        pghandle wApp;
        pgInit(argc,argv);
        
        wApp = pgRegisterApp(PG_APP_NORMAL,"Test",0);
        wPanel=pgNewWidget(PG_WIDGET_BOX, 0, 0);
        pgSetWidget(0,
                    PG_WP_SIDE, PG_S_ALL,
                    0);
        for(;;) drawwindow1();
}       

int drawwindow1(void)
{
        pgEnterContext();

        pgNewWidget(PG_WIDGET_BUTTON,PG_DERIVE_INSIDE,wPanel);
        pgSetWidget(0,
                    PG_WP_TEXT,pgNewString("Redraw"),
                    0);
        pgBind(0,PG_WE_ACTIVATE,&btnRedraw, NULL);

        pgEventLoop();
        pgLeaveContext();
/*      pgUpdate(); Uncomment this line to make it work*/
}

static int btnRedraw(struct pgEvent *evt)
{
        pgExitEventLoop();
        return 0;
}





-------------------------------------------------------
This SF.NET email is sponsored by: Order your Holiday Geek Presents Now!
Green Lasers, Hip Geek T-Shirts, Remote Control Tanks, Caffeinated Soap,
MP3 Players,  XBox Games,  Flying Saucers,  WebCams,  Smart Putty.
T H I N K G E E K . C O M       http://www.thinkgeek.com/sf/
_______________________________________________
Pgui-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/pgui-devel

Reply via email to