To create custom menus, tool tips or drop down lists. They are different from borderless windows, they don't steal the focus from the main window i think.
WS_POPUP in windows and GTK_WINDOW_POPUP in linux, no idea on mac.
Popup windows
Re: Popup windows
Code: Select all
Debug #WS_POPUP
Debug #PB_Window_BorderLess
nco2k
If OSVersion() = #PB_OS_Windows_ME : End : EndIf
Re: Popup windows
I didn't know.
I had to do this to create a custom tooltip, menu or list in a canvas in windows.
So i am asking a crossplatform way to do this:
I had to do this to create a custom tooltip, menu or list in a canvas in windows.
So i am asking a crossplatform way to do this:
Code: Select all
EnableExplicit
Global.i winmain, event, b1, winchild, oldexstyle, canvas
Procedure evhandler()
Debug "mm"
EndProcedure
Procedure evclick()
CloseWindow(winchild)
EndProcedure
Procedure winmainproc(hwnd, msg.i, wparam.i, lparam.i)
Select msg
Case #WM_NCLBUTTONDOWN
If IsWindow(winchild)
CloseWindow(winchild)
EndIf
ProcedureReturn #PB_ProcessPureBasicEvents
Default : ProcedureReturn #PB_ProcessPureBasicEvents
EndSelect
EndProcedure
Procedure winproc(hwnd.i, msg.i, wparam.i, lparam.i)
Select msg
Case #WM_MOUSEACTIVATE
ProcedureReturn #MA_NOACTIVATE
Default : ProcedureReturn #PB_ProcessPureBasicEvents
EndSelect
EndProcedure
winmain = OpenWindow(#PB_Any, 10, 10, 300, 200, "test")
SetWindowCallback(@winmainproc(), winmain)
b1 = ButtonGadget(#PB_Any, 0, 0, 80, 30, "test")
Repeat
event = WaitWindowEvent()
Select event
Case #PB_Event_Gadget
Select EventGadget()
Case b1
If IsWindow(winchild)
CloseWindow(winchild)
Else
winchild = OpenWindow(#PB_Any, 20, 40, 80, 80, "", #PB_Window_BorderLess | #PB_Window_NoActivate , WindowID(winmain))
SetWindowCallback(@winproc(), winchild)
canvas = CanvasGadget(#PB_Any, 0, 0, 80, 80)
BindGadgetEvent(canvas, @evhandler(), #PB_EventType_MouseMove)
BindGadgetEvent(canvas, @evclick(), #PB_EventType_LeftClick)
If StartDrawing(CanvasOutput(canvas))
DrawingMode(#PB_2DDrawing_Transparent)
DrawText(0, 0, "ToolTip", RGB(0, 0, 0))
StopDrawing()
EndIf
EndIf
EndSelect
Case #PB_Event_LeftClick
If IsWindow(winchild) : CloseWindow(winchild) : EndIf
Case #PB_Event_DeactivateWindow
If IsWindow(winchild) : CloseWindow(winchild) : EndIf
EndSelect
Until event = #PB_Event_CloseWindow