Hi !
i've the following problem. when i open the second window and move it on the first, the first canvas is not drawn correctly (see the picture).
How to resolve this ?
Thanks !

i've the following problem. when i open the second window and move it on the first, the first canvas is not drawn correctly (see the picture).
How to resolve this ?
Thanks !

Strict ' ------------------------------------------------------------------------------------------- Extern "win32" Function GetActiveWindow() Function SetWindowPos(hWnd:Int,after:Int,x:Int,y:Int,w:Int,h:Int,flags:Int) End Extern Const SWP_NOSIZE:Int = $1 Const SWP_NOMOVE:Int = $2 Const HWND_TOPMOST:Int = -1 Const HWND_NOTOPMOST:Int = - 2 Function alwaysOnTop(hwnd:Int) SetWindowPos( hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE + SWP_NOMOVE ) End Function Function notAlwaysOnTop(hwnd:Int) SetWindowPos( hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE + SWP_NOMOVE ) End Function ' ------------------------------------------------------------------------------------------- Global win1 : Tgadget = CreateWindow ("Win1",100,100,400,300,Null,WINDOW_TITLEBAR) Global Canvas1 : Tgadget = CreateCanvas (10,40,350,200,Win1) Global Button1 : Tgadget = CreateButton ("Open Win2",10,10,100,20,Win1) HideGadget Win1 Global win2 : Tgadget = CreateWindow ("Win2",200,200,400,300,Null,WINDOW_TITLEBAR) Global Canvas2 : Tgadget = CreateCanvas (10,40,350,200,Win2) HideGadget Win2 Function Draw_First_window () ShowGadget win1 ActivateWindow(Win1) Local hwnd:Int = GetActiveWindow() alwaysOnTop(hwnd) CreateTimer 60 While WaitEvent() Print CurrentEvent.ToString() Select EventID() Case EVENT_TIMERTICK SetGraphics CanvasGraphics(Canvas1) Cls For Local i=0 To GadgetWidth (Canvas1) Step 32 DrawLine i,0,i,GadgetHeight(Canvas1) Next SetColor 0,40,0 For Local i=0 To GadgetHeight (Canvas1) Step 32 DrawLine 0,i,GadgetWidth(Canvas1),i Next Flip Case EVENT_GADGETACTION If EventSource() = Button1 Then Draw_second_window() End If Case EVENT_WINDOWCLOSE Exit End Select Wend HideGadget Win1 End Function Function Draw_second_window () ShowGadget win2 ActivateWindow(Win2) Local hwnd:Int = GetActiveWindow() alwaysOnTop(hwnd) CreateTimer 60 While WaitEvent() Select EventID() Case EVENT_TIMERTICK SetGraphics CanvasGraphics(Canvas2) Cls For Local i=0 To GadgetWidth (Canvas2) Step 32 DrawLine i,0,i,GadgetHeight(Canvas2) Next SetColor 0,40,0 For Local i=0 To GadgetHeight (Canvas2) Step 32 DrawLine 0,i,GadgetWidth(Canvas2),i Next Flip Case EVENT_WINDOWCLOSE Exit End Select Wend HideGadget Win1 End Function Draw_First_Window()