how to draw in a dialog's client area, but from an event ocurred in another dialog?
-
Hello, I hope that somebody can help me, the thing is this: the context: my application has one main dialog and one non-main dialog. the question: When I press a specific button in the non-main dialog, a line has to be drawn in the client area of the main dialog. how can I do this? Actually I have a method declared as public and defined in the main dialog class (an instance from Cdialog let's say) to draw my lines, this is the method:
void CCalibracionDlg::BorrarRecta(int Rx,unsigned char D_Ry, unsigned char Vref)
{CClientDC pDC(this) ;
float tgAng=0,Ry=0; // float porque estas variables tienen cocientes
int x = 0 , y = 0 ,y_=0; // int porque pueden ser mayor q 255
char multiplo=0;
unsigned char indice_recta=0, y_RectaVieja[300]; // con char alcanza
unsigned int pixel=0, PixelRectaVieja[300]; // int porque son de 32bit
pDC.SetWindowOrg(-168,-165); // seteo el origen de coordenadas a ese punto, q es el centro de la grilla
.
.a lot of code that it isn't important for this issue
.
}Of course when i use this code within the main dialog it works fine, the lines are drawn in the client area of the main dialog, but how can i do to use this code to draw in the client area of the main dialog when i press a button in the non-man dialog? . Thanks in advance, let me know if you need more information.
-
Hello, I hope that somebody can help me, the thing is this: the context: my application has one main dialog and one non-main dialog. the question: When I press a specific button in the non-main dialog, a line has to be drawn in the client area of the main dialog. how can I do this? Actually I have a method declared as public and defined in the main dialog class (an instance from Cdialog let's say) to draw my lines, this is the method:
void CCalibracionDlg::BorrarRecta(int Rx,unsigned char D_Ry, unsigned char Vref)
{CClientDC pDC(this) ;
float tgAng=0,Ry=0; // float porque estas variables tienen cocientes
int x = 0 , y = 0 ,y_=0; // int porque pueden ser mayor q 255
char multiplo=0;
unsigned char indice_recta=0, y_RectaVieja[300]; // con char alcanza
unsigned int pixel=0, PixelRectaVieja[300]; // int porque son de 32bit
pDC.SetWindowOrg(-168,-165); // seteo el origen de coordenadas a ese punto, q es el centro de la grilla
.
.a lot of code that it isn't important for this issue
.
}Of course when i use this code within the main dialog it works fine, the lines are drawn in the client area of the main dialog, but how can i do to use this code to draw in the client area of the main dialog when i press a button in the non-man dialog? . Thanks in advance, let me know if you need more information.
timbk wrote:
when i use this code within the main dialog it works fine
There's your answer. If it works in the main dialog, then have the non-main dialog send a message to the main dialog when the button is pressed; the message handler in the main dialog will then draw the line.
Best wishes, Hans
-
timbk wrote:
when i use this code within the main dialog it works fine
There's your answer. If it works in the main dialog, then have the non-main dialog send a message to the main dialog when the button is pressed; the message handler in the main dialog will then draw the line.
Best wishes, Hans
Ok , thanks for your time, well I'm quite newbie programing, folowing your suggestion , the message that I use in the non-main's button is BN_CLICKED, and of course i have a method to handle this message, but , can you tell me how can i do to send a message to the main dialog from this message handler in the non-main dialog?