alis
13th June 2009, 08:23 AM
Hi all,
I have 2 class one for subwin and other for win, the window of win class is parent of subwin window.
I create a window and have 4 subwindow, and want to repaint window.
There are some of my code below:
#1#
In SubWindow class
XEvent EventPaint;
void SubWindow::Redisplay()
{
EventPaint.type = Expose;
EventPaint.xexpose.display = display;
EventPaint.xexpose.window = window;
EventPaint.xexpose.send_event = false;
EventPaint.xexpose.count = 1;
EventPaint.xexpose.x = winX;
EventPaint.xexpose.y = winY;
EventPaint.xexpose.width = Width;
EventPaint.xexpose.height = Height;
EventPaint.xexpose.serial = 0;
XSendEvent(display,window,false,ExposureMask,&EventPaint);
XFlush(display);
}
#2#
In Window class
XNextEvent(display,&event);
switch(event.type)
{
case Expose:
// return subwindow number for subwindow Window
WindowNumber = RepaintWindow(event.xexpose.window); switch( WindowNumber )
{
case 0:
Paint();
break;
case 1:
sub1.Paint();
break;
...
}
#########
In section 1, I printf the EventPaint.xexpose.window and that has correct value,
but in section 2, that is the main program when I printf the EventPaint.xexpose.window,I have only the main window number. And only my main(parent) window redisplay.
I think that send message don't work!
Why when I receive message I receive main window insted of subwindow window??
Thanks.
I have 2 class one for subwin and other for win, the window of win class is parent of subwin window.
I create a window and have 4 subwindow, and want to repaint window.
There are some of my code below:
#1#
In SubWindow class
XEvent EventPaint;
void SubWindow::Redisplay()
{
EventPaint.type = Expose;
EventPaint.xexpose.display = display;
EventPaint.xexpose.window = window;
EventPaint.xexpose.send_event = false;
EventPaint.xexpose.count = 1;
EventPaint.xexpose.x = winX;
EventPaint.xexpose.y = winY;
EventPaint.xexpose.width = Width;
EventPaint.xexpose.height = Height;
EventPaint.xexpose.serial = 0;
XSendEvent(display,window,false,ExposureMask,&EventPaint);
XFlush(display);
}
#2#
In Window class
XNextEvent(display,&event);
switch(event.type)
{
case Expose:
// return subwindow number for subwindow Window
WindowNumber = RepaintWindow(event.xexpose.window); switch( WindowNumber )
{
case 0:
Paint();
break;
case 1:
sub1.Paint();
break;
...
}
#########
In section 1, I printf the EventPaint.xexpose.window and that has correct value,
but in section 2, that is the main program when I printf the EventPaint.xexpose.window,I have only the main window number. And only my main(parent) window redisplay.
I think that send message don't work!
Why when I receive message I receive main window insted of subwindow window??
Thanks.