Hi
Question is simple, how we can detect right click on toolbar button?
Detect right click on toolbar button
Re: Detect right click on toolbar button
Hi
For Windows
Added #2:
For Windows
Code: Select all
Global lpPrevWndFunc
Procedure tbCB(hWnd, uMsg, wParam, lParam)
Select uMsg
Case #WM_CONTEXTMENU
Debug SendMessage_(ToolBarID(0), #TB_GETHOTITEM, 0,0)
ProcedureReturn 0
EndSelect
ProcedureReturn CallWindowProc_(lpPrevWndFunc, hWnd, uMsg, wParam, lParam)
EndProcedure
If OpenWindow(0, 0, 0, 200, 150, "Right Click ToolBar", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
If CreateToolBar(0, WindowID(0))
ToolBarStandardButton(0, #PB_ToolBarIcon_New)
ToolBarStandardButton(1, #PB_ToolBarIcon_Open)
ToolBarStandardButton(2, #PB_ToolBarIcon_Save)
ToolBarSeparator()
ToolBarStandardButton(3, #PB_ToolBarIcon_Print)
ToolBarStandardButton(4, #PB_ToolBarIcon_Find)
ToolBarSeparator()
EndIf
lpPrevWndFunc = SetWindowLongPtr_(ToolBarID(0), #GWL_WNDPROC, @tbCB())
Repeat
EventID = WaitWindowEvent()
Select EventID
Case #PB_Event_CloseWindow
Quit = 1
EndSelect
Until Quit = 1
EndIf
End
Code: Select all
If OpenWindow(0, 0, 0, 200, 150, "Right Click ToolBar", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
If CreateToolBar(0, WindowID(0))
ToolBarStandardButton(0, #PB_ToolBarIcon_New)
ToolBarStandardButton(1, #PB_ToolBarIcon_Open)
ToolBarStandardButton(2, #PB_ToolBarIcon_Save)
ToolBarSeparator()
ToolBarStandardButton(3, #PB_ToolBarIcon_Print)
ToolBarStandardButton(4, #PB_ToolBarIcon_Find)
ToolBarSeparator()
EndIf
Repeat
EventID = WaitWindowEvent()
Select EventID
Case #PB_Event_CloseWindow
Quit = 1
Case #WM_RBUTTONUP
index = SendMessage_(ToolBarID(0), #TB_GETHOTITEM, 0,0)
If index >= 0
Debug index
EndIf
EndSelect
Until Quit = 1
EndIf
End
Egypt my love
Re: Detect right click on toolbar button
Many thanks RASHAD 
