Hello,
Could anybody help me in order to detect the StatusBar events?
Here it is an example from fsw, but if we add a TreeGadget, the detection goes wrong.
Code: Select all
; Example Of A Statusbar Click Event
; (c) 2003 - By FSW
;
; Tested under WinXP
; do whatever you want with it
;
#Window = 10
#StatusbarFocus = 528
#StatusBar = 1
#Tree = 2
Procedure  LoWord (var)
  ProcedureReturn var & $FFFF
EndProcedure
Procedure MyWindowCallback(WindowID, Message, wParam, lParam)
  Result = #PB_ProcessPureBasicEvents
  
  wParamLo = LoWord(wParam)
  lParamLo = LoWord(lParam)
  
  ;513 = $201
  
  If Message = #StatusbarFocus ;#StatusbarFocus  ;528 = $210 = #WM_PARENTNOTIFY
    If wParamLo = #WM_LBUTTONDOWN And lParamLo < 270 ; 270 is the width of field 1
      MessageRequester("Message", "Left Mouse Click In StatusBar Field 1. "+"MousePos: "+Str(lParamLo))
    ElseIf wParamLo = 513 And lParamLo > 270 + 2 ; there is a BAR between the 2 fields...
      MessageRequester("Message", "Left Mouse Click In StatusBar Field 2. "+"MousePos: "+Str(lParamLo))
    ElseIf wParamLo = 516
      MessageRequester("Message", "Right Mouse Click In StatusBar. "+"MousePos: "+Str(lParamLo))
    EndIf
    
  EndIf
  
  ProcedureReturn Result
EndProcedure
If OpenWindow(#Window,0,0,355,180,"Statusbar Click",#PB_Window_SystemMenu|#PB_Window_ScreenCentered)
  
  CreateStatusBar(#StatusBar, WindowID(#Window))
  AddStatusBarField(90)
  
  StatusBarText(#StatusBar, 0, "Hello World!")
  AddStatusBarField(270)
  AddStatusBarField(80)
  
  TreeGadget(#Tree,10,45,100,100,#PB_Tree_AlwaysShowSelection)
  SendMessage_(GadgetID(#Tree),$111D,0,14675967)
  
  
  SetWindowCallback(@MyWindowCallback())
  
  Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
  
EndIf
QuimV

