[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[MiNT] Dialogs in windows



Hello everyone,

I have a little problem with a GEM-application I wrote with gcc 2.9.x and
Interface 2.33. 

There is a form lying in a window. Whenever I move this window everything is
fine when it is topped. When it is lying in the background and topped again
I get a rectangle of the part of the window I have to redraw.

Unfortunately when the window is lying in the background and moved it gets a
WM_REDRAW message but when I try to get the rectangles I have to rewrite I
get some real funny results.

Imagine my window lying in the middle of the screen and another window is
lying above it in the lower right corner of the window of my application. 

So my window is divided into three parts. The upper half of the window is
free. The lower half is divided into two parts. The left hand side is free
while the right hand side is hidden by another applications window.

Then I move my application to the left of the desktop (not up). But instead
of getting just the lower left part of my window so I can redraw it, I get
both "free" parts of my own window.

This is the code I wrote:

static void redraw_mywindow( short my_window, short x, short y, short w,
short h )
{
  GRECT r;
  
  short w1, w2, w3, w4;
 
  /* is window topped?
  /* then redraw rectangle 
		 
  wind_get( my_window, WF_TOP, &w1, &w2, &w3, &w4 );
	
  if( window == w1 )
  {
    wind_update( BEG_UPDATE );		
	
    wind_get_grect( my_window, 
      WF_WORKXYWH, 
      &r );

    /* this is my infodialog that should be redrawn		
    infodialog->ob_x = r.g_x + 2;
    infodialog->ob_y = r.g_y + 2;
    infodialog->ob_width = r.g_w - 4;
    infodialog->ob_height = r.g_h - 4;
		
    objc_draw( infodialog, ROOT, MAX_DEPTH,
      x,
      y,
      w,
      h );

    wind_update( END_UPDATE );  /* Fenstererneuerung beendet */
  }
  else
  {
    /* only redraw the part of the window that is not hidden */
    wind_get( my_window, WF_FIRSTXYWH, &w1, &w2, &w3, &w4 );
    while( w3 && w4 )
    {
      wind_get_grect( my_window, 
        WF_WORKXYWH, 
	  &r );
  	printf( "x: %i y: %i w: %i h: %i\r\n", 
        w1, 
        w2, 
        w3, 
        w4 );
  	printf( "r.g_x: %i r.g_y: %i, r.g_w: %i, r.g_h: %i\r\n", 
        r.g_x, 
        r.g_y, 
        r.g_w, 
        r.g_h );
  	wind_get( my_window, WF_NEXTXYWH, &w1, &w2, &w3, &w4 );
    }
  }
} 

Any hints?

I also played around with windom but unfortunately when I want to use this
library it seems to me that I have to rewrite a lot of code of my
application (AppInit() instead of app_init() etc.) so finally I decided not
to use windom.

Are there any other libraries that are just enhancements of the gemlib so I
can stay with my old source and just do some extensions?

Regards,

Frank