move a skinned window
BlitzPlus Forums/BlitzPlus Programming/move a skinned window
| ||
| Hi ! in my project, i use a skinned window, so i've written the following code to move the window. In fact the window contains another 400x300 canvas inside. In this canvas, i display my tiny game. I use a timer for the game refresh rate. But i've a pb with waittimer line. If you keep pressed the mouse button and move the window, sometime my b+ code doesn't detect when you release the mouse button, and you continue to move the window ! If i uncomment the line, i've no pb ! Is there a better solution ? I must keep the waitimer line for the inside game canvas ! Thanks !
Win = CreateWindow(kText01$,300,300,200,200,Desktop(),0)
cvs = CreateCanvas (0,0,200,200, Win)
btn = CreateButton ("Bouton", 50,50,60,100, cvs)
Global tmr
tmr = CreateTimer(60)
Quit = False
While Not Quit
WaitEvent()
Select EventID()
Case $201
If EventSource() = cvs Then
bMoveWindow = True
End If
Case $202
bMoveWindow = False
Case $203
If bMoveWindow = True Then
If aMouseX <> 0 And aMouseY <> 0 Then
deltaX = aMouseX - MouseX(cvs)
deltaY = aMouseY - MouseY(cvs)
SetGadgetShape Win, GadgetX(Win) - DeltaX,GadgetY(Win) - DeltaY, GadgetWidth (Win), GadgetHeight(Win)
End If
End If
End Select
aMouseX = MouseX(cvs)
aMouseY = MouseY(cvs)
WaitTimer(tmr) < ------- Comment/Uncomment this line
If EventSource() = btn Then Quit = True
Wend
|