Scintilla Mouse Pan

Share your advanced PureBasic knowledge/code with the community.
User avatar
eddy
Addict
Addict
Posts: 1479
Joined: Mon May 26, 2003 3:07 pm
Location: Nantes

Scintilla Mouse Pan

Post by eddy »

Code updated For 5.20+
This is bug fix for scintilla window version. it handles the autoclose event.

Code: Select all

Procedure SciMousePanCallBack(Result,WindowID, Message, wParam, lParam)
  If result= #PB_ProcessPureBasicEvents   
    If Message=#WM_PARENTNOTIFY And PeekW(@wParam)=#WM_MBUTTONDOWN
      Shared SciMousePan
      SciMousePan=1
     EndIf 
  EndIf 
  
  ProcedureReturn Result
EndProcedure 

Procedure SciMousePanEnd()
  Shared SciMousePan
  If SciMousePan 
    Repeat
    Until WaitWindowEvent()=#PB_Event_CloseWindow  
  EndIf 
EndProcedure 

Procedure MyWindowCallback(WindowID, Message, wParam, lParam)
  Result = #PB_ProcessPureBasicEvents
  Result = SciMousePanCallBack(Result,WindowID, Message, wParam, lParam)
  ;
  ; your code
  ;
  ProcedureReturn Result
EndProcedure

SetWindowCallback(@MyWindowCallback())

Repeat 
  SciMousePanEnd()
  eventID = WaitWindowEvent() 
  Select eventID 
    Case #PB_Event_CloseWindow       
  EndSelect 
Until eventID=#PB_Event_CloseWindow 


Imagewin10 x64 5.72 | IDE | PB plugin | Tools | Sprite | JSON | visual tool