CreatePanelEx

www.progui.co.uk  Top  Previous  Next

CreatePanelEx()

Syntax

WindowsID.i = CreatePanelEx(PanelID.l, WindowID.i, X.l, Y.l, Width.l, Height.l, *UserCallback)

Description

Creates an empty PanelEx container in the current WindowID.i at the specified coordinates and dimensions.

PanelID.l specifies the internal ID of the PanelEx and if #ProGUI_Any is used then the returned value will be the new PanelEx ID.

A page must then be added to the empty PanelEx after it is created using either AddPanelExPage, AddPanelExImagePage, InsertPanelExPage or InsertPanelExImagePage. Once a page has been added to the PanelEx, other controls can then be added/created to that page. To swap the currently displayed page in the PanelEx, use ShowPanelExPage.

*UserCallback is optional and if nonzero then it must point to a user defined procedure. The UserCallback gets passed all the PanelEx's Windows messages allowing you to use the PanelEx as a building block for creating other controls. The *UserCallBack procedure is defined by the following:

 

Procedure mypanelcallback(window, message, wParam, lParam)

 

The #WM_ERASEBKGND and #WM_PAINT messages work a bit differently in the UserCallback. The #WM_ERASEBKGND message when processed allows you to draw after the PanelEx page background has been rendered and the #WM_PAINT message allows you to draw in the foreground of the PanelEx page (after all other controls inside the page and background have been rendered). In both messages the window parameter contains a handle to the page, wParam contains the hdc buffer and lParam contains a handle to the PanelEx. Also, all user drawing in the callback is automatically double-buffered.

 

An example of using the UserCallback feature is automatic resizing of a PanelEx contents when it's resized, the following demonstrates automatic resizing of a ListIcon gadget inside a PanelEx Page when the PanelEx size is changed: -

 

Procedure myPanelCallback(window, message, wParam, lParam)

 

  Select message

 

    Case #WM_SIZE

 

      MoveWindow_(GadgetID(#ListIcon_1), 0, 0, LWord(lParam), HWord(lParam), #False)

 

  EndSelect

 

EndProcedure

 

Returns the Windows ID (HWND) of the PanelEx (or if #ProGUI_Any is used the PanelEx ID) or zero for failure.

 

PanelEx Index