API gadgets, panels and some hidden window?

Everything else that doesn't fall into one of the other PB categories.
Karbon
PureBasic Expert
PureBasic Expert
Posts: 2010
Joined: Mon Jun 02, 2003 1:42 am
Location: Ashland, KY
Contact:

API gadgets, panels and some hidden window?

Post by Karbon »

I understand that PB uses a hidden window to support XP skins for panel gadgets (or something like that).

I need to add an API date picker gadget on a panel and can't because of this hidden window thing. Can anyone tell me how to find the ID of this hidden window that comes with panel gadgets?
-Mitchell
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
GreenGiant
Enthusiast
Enthusiast
Posts: 252
Joined: Fri Feb 20, 2004 5:43 pm

Post by GreenGiant »

Well I'm not sure, but I may have found a way to do it. Here's my code:

Code: Select all

Procedure EnumProc(hWnd,lParam)
  Debug "Child Window: "+Str(hWnd)
EndProcedure

OpenWindow(0,0,0,400,400,#PB_Window_SystemMenu | #PB_Window_ScreenCentered,"test")
CreateGadgetList(WindowID(0))
PanelGadget(0,10,10,380,380)
EnumChildWindows_(WindowID(0),@EnumProc(),0)
Debug "Parent of Panel: "+Str(GetParent_(GadgetID(0)))

Debug "Main Window: "+Str(WindowID(0))
Debug "Gadget: "+Str(GadgetID(0))

Repeat
ev=WaitWindowEvent()
Until ev=#PB_Event_CloseWindow
If the child window I'm finding is the one you're talking about then the line

Code: Select all

GetParent_(GadgetID(0))

is succesfully getting the ID of it.
Kale
PureBasic Expert
PureBasic Expert
Posts: 3000
Joined: Fri Apr 25, 2003 6:03 pm
Location: Lincoln, UK
Contact:

Post by Kale »

This is how i do it:

Code: Select all

;===========================================================================
;-CONSTANTS
;===========================================================================

#APP_NAME = "Window Template"

Enumeration
    #WINDOW_ROOT
    #PANEL_CALENDAR
    #FRAME_CALENDAR
    #FRAME_CALENDAR2
EndEnumeration

;===========================================================================
;-PROCEDURES
;===========================================================================

;Handle an error
Procedure HandleError(Result, Text.s)
    If Result = 0 : MessageRequester("Error", Text, #PB_MessageRequester_Ok) : End : EndIf
EndProcedure

;===========================================================================
;-GEOMETRY
;===========================================================================

HandleError(OpenWindow(#WINDOW_ROOT, 0, 0, 400, 300, #PB_Window_SystemMenu | #PB_Window_ScreenCentered, #APP_NAME), "Main window could not be created.")

HandleError(CreateGadgetList(WindowID(#WINDOW_ROOT)), "Gadget list for the main window could not be created.")

PanelGadget(#PANEL_CALENDAR, 10, 10, 380, 280)
    AddGadgetItem (#PANEL_CALENDAR, -1, "Calendar Example Page 1")
        hCalendarFrame = Frame3DGadget(#FRAME_CALENDAR, 10, 10, 190, 155, "")
        hCalendarGadget.l = CreateWindowEx_(0, "SysMonthCal32", #NULL, #WS_CHILD | #WS_VISIBLE | #WS_BORDER, 0, 0, 190, 155, hCalendarFrame, 0, GetModuleHandle_(#NULL), 0) 

    AddGadgetItem (#PANEL_CALENDAR, -1, "Calendar Example Page 2")
        hCalendarFrame2 = Frame3DGadget(#FRAME_CALENDAR2, 40, 40, 190, 155, "")
        hCalendarGadget.l = CreateWindowEx_(0, "SysMonthCal32", #NULL, #WS_CHILD | #WS_VISIBLE | #WS_BORDER, 0, 0, 190, 155, hCalendarFrame2, 0, GetModuleHandle_(#NULL), 0) 
    CloseGadgetList()
;===========================================================================
;-MAIN LOOP
;===========================================================================

Repeat
    EventID.l = WaitWindowEvent()
Until EventID = #PB_Event_CloseWindow
End
--Kale

Image
Karbon
PureBasic Expert
PureBasic Expert
Posts: 2010
Joined: Mon Jun 02, 2003 1:42 am
Location: Ashland, KY
Contact:

Post by Karbon »

interesting... Just got an "OK" from Fred about native date gadgets in PB so hopefully we won't have to hack like this for long!
-Mitchell
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
Post Reply