Page 1 of 1

restricted directions for windowmoving ?

Posted: Fri Mar 18, 2005 2:50 am
by Hroudtwolf
Hello everybody,

I'm using this API to move my windows with an lbuttondown event:

Code: Select all

ReleaseCapture_()
SendMessage_(WindowID(), #WM_SYSCOMMAND, #SC_MOVE + #HTCAPTION, 0)
With it , my window moves the mouse afterwards in all directions.
But I want ,that my windows moves only in one direction (Up/Down).

Is anybody knowing a way to do it ?

Posted: Fri Mar 18, 2005 3:24 am
by Sparkie
Try this one...

Code: Select all

Procedure myWindowCallback(hwnd, msg, wparam, lparam)
  result = #PB_ProcessPureBasicEvents
  Select msg
    Case #WM_WINDOWPOSCHANGING 
      If hwnd = WindowID(0)
        *wPos.WINDOWPOS = lparam 
        ;--> We'll keep the left side of the window locked to 100
        *wPos\x = 100
      EndIf
  EndSelect
  ProcedureReturn result
EndProcedure
If OpenWindow(0, 100, 200, 200, 200, #PB_Window_SystemMenu, "Lock left side of Window") And CreateGadgetList(WindowID(0))
  SetWindowCallback(@myWindowCallback())
  Repeat
    event = WaitWindowEvent()
  Until event = #PB_Event_CloseWindow
EndIf

Posted: Fri Mar 18, 2005 4:27 am
by Hroudtwolf
YES... :D .......YES.YES.YES... ->IAMDANCINGAROUNDMYPC<-

Thank you....