Message Box

Hi everyone,

I am trying to achieve a sort of MessageBox functionality with GUIX. For this, I would like to grey out the background (with transparent black, 50% alpha channel) and then draw the messagebox window on top of that. The underlying window that called the messagebox must not 'pop through' with any refreshing of buttons etc.

I already tried drawing a pixelmap I have saved with these properties and that worked so far, however when I draw the window, which only covers the middle of the screen, apparently the whole canvas gets refreshed and my grey background is gone again.

Any idea how I could achieve this functionality?

I attached a screenshot of the semitransparent pixelmap over the main window (the draw is invoked by the button, which also 'pops through' afterwards, since it is refreshed as 'not pressed'.



  • Nevermind, I managed to find a solution. I created a window that has the message box as a children window. This container window has a normal background and a special draw function. This draw function then creates my semitransparent background and draws the children (the messagebox):

    VOID window_messagebox_draw(GX_WINDOW *widget)
        GX_CANVAS *canvas;
        UINT result;
        GX_PIXELMAP *pixlmap;
        result = gx_widget_canvas_get((GX_WIDGET*)p_window_root,&canvas);
        result = gx_canvas_drawing_initiate(canvas, widget, &p_window_root->gx_widget_size);
        result = gx_widget_pixelmap_get(widget,GX_PIXELMAP_ID_SCREEN50ALPHA,&pixlmap);
        result = gx_canvas_pixelmap_draw(0,0,pixlmap);
        result = gx_canvas_drawing_complete(canvas,GX_TRUE);

    GX_PIXELMAP_ID_SCREEN50ALPHA is a pixelmap the size of my screen and 50% alpha black, which makes it semitransparent.

    Example Screenshot of the finished messagebox: