Is there a way to get the PB internal handle of an NSWindow?
The opposed of WindowID()
How can I get PB window of an NSWindow?
How can I get PB window of an NSWindow?
macOS Catalina 10.15.7
Re: How can I get PB window of an NSWindow?
You may take a look into mk-soft's cross-platform system module and call procedure System::WindowPB(WindowHandle). For your conveniance I have extracted the essential MacOS parts into the following example:
Code: Select all
ImportC ""
PB_Object_EnumerateStart(PB_Objects.I)
PB_Object_EnumerateNext(PB_Objects.I, *ID.Integer )
PB_Object_EnumerateAbort(PB_Objects.I)
PB_Window_Objects.I
EndImport
Procedure GetPBWindowIDFromWindowHandle(WindowHandle.I)
Protected Result.I = -1
Protected PBWindowID.I
PB_Object_EnumerateStart(PB_Window_Objects)
While PB_Object_EnumerateNext(PB_Window_Objects, @PBWindowID)
If WindowHandle = WindowID(PBWindowID)
Result = PBWindowID
Break
EndIf
Wend
PB_Object_EnumerateAbort(PB_Window_Objects)
ProcedureReturn Result
EndProcedure
OpenWindow(3, 270, 100, 200, 170, "Test")
MessageRequester("Info",
"PB WindowID = " + Str(GetPBWindowIDFromWindowHandle(WindowID(3))))
Re: How can I get PB window of an NSWindow?
Or you can save it first and then retrieve it:
Code: Select all
EnableExplicit
Define.i win
win = OpenWindow(#PB_Any, 10, 10, 600, 400, "test")
Debug win
objc_setAssociatedObject_(WindowID(win), "_PBWinID", win, 0)
MessageRequester("Info", "PB WindowID: " + Str(objc_getAssociatedObject_(WindowID(win), "_PBWinID")))
Re: How can I get PB window of an NSWindow?
Thanks Shardik. I didn't notice mk-soft's post.Shardik wrote:You may take a look into mk-soft's cross-platform system module and call procedure System::WindowPB(WindowHandle). For your conveniance I have extracted the essential MacOS parts into the following example:
macOS Catalina 10.15.7