GadgetWindowID( Gadget )

Share your advanced PureBasic knowledge/code with the community.
mestnyi
Addict
Addict
Posts: 1000
Joined: Mon Nov 25, 2013 6:41 am

GadgetWindowID( Gadget )

Post by mestnyi »

To get a window where the gadget.

Code: Select all

Procedure GadgetWindowID( Gadget )
    CompilerSelect #PB_Compiler_OS
      CompilerCase #PB_OS_Windows
        ProcedureReturn GetAncestor_( GadgetID( Gadget ), #GA_ROOT )
      CompilerCase #PB_OS_Linux
        ProcedureReturn gtk_widget_get_toplevel_( GadgetID( Gadget ))
      CompilerCase #PB_OS_MacOS ; TODO
    CompilerEndSelect
  EndProcedure
It would be nice to add for mac os. :wink: