WinCreateSplitPane |
This function facilitate the creation of splitpanes by automatically creating its child panes and allowing the creation of complex layouts made by multiple nested splitpanes. |
Syntax: |
HWND EXPENTRY WinCreateSplitPane(HWND hwndPO, ULONG style, ULONG id,
LONG x, LONG y, LONG cx, LONG cy,
PSPLITPCREATE pCreate); |
Parameters: |
HWND hwndPO: | handle of the owner and parent window (they must be the same window). |
ULONG style: | ordinary window styles (WS_* flags) and splitpane styles. |
ULONG id: | id of the splitpane window. |
LONG x: | x coordinate of the splitpane window. |
LONG y: | y coordinate of the splitpane window. |
LONG cx: | splitpane width in pixels. |
LONG cy: | splitpane height in pixels. |
PSPLITPCREATE pCreate: | address of a SPLITPCREATE structure containing the data needed for the splitpane creation. |
Return value: |
HWND: | window handle of the created splitpane. |
Remarks: |
This function is most typically called when processing the WM_CREATE message of client windows. |
Example: |
MRESULT onClientInit(HWND hwnd, PCREATESTRUCT pcreate) {
// create 3 splitpanes : one main and 2 recursively nested ones
SPLITPCREATE scP, sc1, sc2;
SPLITCTLDATA scd;
CHAR buf[64];
INT i;
BOOL rc;
zerostruct(scP); // memset structs to 0 - see axh\axbase.h
zerostruct(sc1);
zerostruct(sc2);
zerostruct(scd);
// initialize the parent splitpane data
// left/top pane is a listbox
scP.pane1.class = WC_LISTBOX;
scP.pane1.style = LS_NOADJUSTPOS | WS_TABSTOP;
scP.pane1.id = ID_LBOX;
// right/bottom pane is a nested splitpane
scP.pane2.pSplitCreate = &sc1;
scP.pane2.style = SPLITS_HORIZONTAL | SPLITS_HIDEPANES;
scP.pane2.id = ID_NESTED1;
scP.pane2.type = SPLITCHILD_SPLIT; // nested splitpane
// set the control data of the main pane
scP.pCtlData = &scd;
scd.cb = sizeof(scd);
scd.minLeft = 100; // minimum widht of the left pane
scd.minRight = 100; // minimum widht of the right pane
scd.splitterPos = -30; // 30 % of total width
scd.flag = SPLITCD_POS | SPLITCD_MINLEFT | SPLITCD_MINRIGHT;
// initialize the first nested splitpane
// left/top pane is a nested splitpane
sc1.pane1.pSplitCreate = &sc2;
sc1.pane1.id = ID_NESTED2;
sc1.pane1.style = SPLITS_HIDEPANES;
sc1.pane1.type = SPLITCHILD_SPLIT; // nested splitpane
// right/bottom pane is a multi-line edit
sc1.pane2.class = WC_MLE;
sc1.pane2.text = SZ_MLETEXT;
sc1.pane2.style = MLS_BORDER | MLS_WORDWRAP | WS_TABSTOP;
sc1.pane2.id = ID_MLE;
// initialize the inner nested splitpane
// left/top pane is a dialog window
sc2.pane1.pDlgProc = testDlgProc;
sc2.pane1.id = ID_DLG;
sc2.pane1.type = SPLITCHILD_DLG;
// right/bottom pane is a static text window
sc2.pane2.class = WC_STATIC;
sc2.pane2.text = SZ_STATICSAMPLE;
sc2.pane2.style = SS_TEXT | DT_WORDBREAK;
sc2.pane2.id = ID_STATIC;
rc = !WinCreateSplitPane(hwnd, WS_VISIBLE | SPLITS_HIDEPANES,
ID_SPLITMAIN,
0, 0, pcreate->cx, pcreate->cy, &scP);
|