(Win10 pb6.0 64b and win xp pb5.73 32b)
I create a borderless window with a canva.
If i clic in the canvas, in the blue area and move, i move the window and it's ok.
If i clic on the red area, i resize the window on the left only and that's what i want but i want to do it without moving the window.
And this is the bug: it moves and it moves only to the top !
Can you see the bug ?
Thanx.
M.
Code: Select all
; EnableExplicit ; Bug with Shared ?
Global ww=400
Global wh=200
Global xwin=500
Global xwin0=500
Procedure Exit()
End
EndProcedure
Procedure LeftMouseDown()
Shared MouseDown, OffsetX, OffsetY
MouseDown = #True
offsetX = WindowMouseX(0)
OffsetY = WindowMouseY(0)
EndProcedure
Procedure LeftMouseUp()
Shared MouseDown
MouseDown = #False
EndProcedure
Procedure MouseMove()
Shared MouseDown, OffsetX, OffsetY
Protected x= GetGadgetAttribute(1, #PB_Canvas_MouseX)
Protected y= GetGadgetAttribute(1, #PB_Canvas_MouseY)
If MouseDown And GetGadgetAttribute(1,#PB_Canvas_Buttons)&#PB_Canvas_LeftButton
;Resize
If (x<20 And y>180)
xwin=DesktopMouseX()-OffsetX
ResizeWindow(0,xwin,#PB_Ignore,xwin0-xwin,#PB_Ignore);<=== bug ? It should not move up !
ResizeGadget(1,0,0,xwin0-xwin,#PB_Ignore)
Else
;Move
ResizeWindow(0,DesktopMouseX()-OffsetX,DesktopMouseY()-OffsetY,#PB_Ignore,#PB_Ignore)
EndIf
EndIf
EndProcedure
Procedure ResizeMe()
If StartDrawing(CanvasOutput(1))
Box(0,0,OutputWidth(),OutputHeight(),RGB(0,0,128))
Box(0,OutputHeight()-20,20,20,#Red)
DrawingMode(#PB_2DDrawing_Transparent)
DrawText(5, 5, "Clic on the blue to move")
DrawText(5, 25, "Clic on the red to resize on the left *without moving*")
DrawText(5, 55, "Bug: it can move up when resizing")
DrawText(5, 85, "Rigth clic to end")
StopDrawing()
EndIf
EndProcedure
If OpenWindow(0, xwin, 300, ww, wh, "Moveable window", #PB_Window_BorderLess)
CanvasGadget(1,0,0,ww,wh)
BindEvent(#PB_Event_Gadget,@Exit(),0,1,#PB_EventType_RightClick)
BindEvent(#PB_Event_Gadget,@LeftMouseDown(),0,1,#PB_EventType_LeftButtonDown)
BindEvent(#PB_Event_Gadget,@LeftMouseUp() ,0,1,#PB_EventType_LeftButtonUp)
BindEvent(#PB_Event_Gadget,@MouseMove() ,0,1,#PB_EventType_MouseMove)
BindEvent(#PB_Event_Gadget,@ResizeMe() ,0,1,#PB_EventType_Resize)
ResizeMe()
Repeat:WaitWindowEvent():ForEver
EndIf