[ Next ] [ Previous ] | Chapter 22 |
The notebook control is designed to provide the user
with a visual organize of information, similar to a real notebook with
dividers. Information can be broken up into categories, with the major
tabs representing category headings. Information can be then
further broken up using minor tabs as teh subcategory headings.
The notebook consists of six major perts, as illustratedin Figure 22.1:
the binding, status line, intersection of pages, forward/backward page
buttons, major tabs, and minor tabs.
A notebook should be used to offer the user a choice of settings or to
present data that can be organized logically into categories or
groupes. Information that can be grouped together should be put into a
single tabbed section. Major tabs can be placed at any of the four
notebook sides; howeever, minor tabs always are placed perpendicular to
the major tabs. Page buttons are provided to allow the user to page
forward and backward between the notebook pages. Page buttons always
are located in the corner that is flanked by the back pages. The
bindings can either be spiral-bound or solid-bound, depending on the
specified style. A line of status text can be associated with each
notebook page. If more than one page exists in a category, the staus
line should be used to indicate this to the user; for example,
"Page 1 of 20". The status line can be left-justied, right-justified,
or centered along the bottom of the notebook. The last part of the
notebook is the insertion of the back pages, used to design a
landscape- or portrait-mode notebook. This feature gives the appearance
of a three-dimensional notebook. This intersection can be located at
any of the four corners. Figures 22.2 through 22.9 show the eight
possible combinations of styles.
[...]
Style |
Description |
Backpage Orientation |
|
BKS_BACKPAGESBR |
Intersection of pages is located at the Bottom Right corner |
BKS_BACKPAGESBL |
Intersection of pages is located at the Bottom Left corner |
BKS_BACKPAGESTR |
Intersection of pages is located at the Top Right corner |
BKS_BACKPAGESTL |
Intersection of pages is located at the Top Left corner |
Major Tab Side | |
BKS_MAJORTABRIGHT |
Major tabs are located on the Right side |
BKS_MAJORTABLEFT |
Major tabs are located on the Left side |
BKS_MAJORTABTOP |
Major tabs are located on the Top side |
BKS_MAJORTABBOTTOM |
Major tabs are located on the Bottom side |
Tab Type |
|
BKS_SQUARETABS |
Notebook has Square edged tabs |
BKS_ROUNDEDTABS |
Notebook has Round edged tabs |
BKS_POLYGONTABS |
Notebook has Polygon edged tabs |
Binding type |
|
BKS_SOLIDBIND |
Notebook has a Solid binding |
BKS_SPIRALBIND |
Notebook has a Spiral binding |
Status
line text justification |
|
BKS_STATUSTEXTLEFT |
Notebook has the status text Left justify |
BKS_STATUSTEXTRIGHT |
Notebook has the status text Right justify |
BKS_STATUSTEXTCENTER |
Notebook has the status text Centered |
Tab text justification |
|
BKS_TABTEXTLEFT |
Notebook has the tab text Left-justified |
BKS_TABTEXTRIGHT |
Notebook has the tab text Right-justified |
BKS_TABTEXTCENTER |
Notebook has the tab text centered |
Tabbed dialog styles |
|
BKS_TABBEDDIALOG |
Tabbed dialog |
BKS_BUTTONAREA |
Reserve space for |
A notebook page is designed to be associated with a dialog box or
window. When a new page is selected in a notebook, the notebook
invalidates the new page, causing a WM_PAINT to be sent to the
procedure associated with newly selected page. When a notebook is
created, the initialization should handle the insertion of any needed
pages. If a page has a major or minor tab associated with it, this is
specified in the BKM_INSERTPAGE. The following code segment shows how
to insert a page.
ULONG ulPageID;
MRESULT mrReply;
mrReply = WinSendMsg(hwndNotebook,
BKM_INSERTPAGE,
(MPARAM)0,
MPFROM2SHORT(BKA_MAJOR|BKA_STATUSTEXTON,
BKA_FIRST)));
ulPageID = LONGFROMMR( mrReply);
If no major or minor tabs are specified, the new page becomes part of
the current section. Each page has a ulPageId
that is returned from the
BKM_INSERTPAGE message. This ID is used extensively in the notebook
messaging system.
The following example program illustates the
creation of a notebook.
NOTEBOOK.C
NOTEBOOK.RC
NOTEBOOK.H
NOTEBOOK.MAK
NOTEBOOK.DEF
In the WM_CONTROL message processing, the BKN_PAGESELECTED
notification code is sent each time a ne page is selected in the
notebook. We'll use this message as a signal to set the focus to the
specified dialog control for the selected page. The BKN_PAGESELECTED
notification code returns a pointer to the PAGESELECTNOTIFY structure.
The structure looks like this:
typedef struct _PAGESELECTNOTIFY /* pgsntfy */
{
HWND hwndBook; /* Notebook window handle */
ULONG ulPageIdCur; /* Previous top page id */
ULONG ulPageIdNew; /* New top Page id */
} PAGESELECTNOTIFY;
typedef PAGESELECTNOTIFY *PPAGESELECTNOTIFY;
The item we are interested in is the new top page ID, ulPageIdNew. This value is
used to query the window handle of the new page.
ppsnSelect = PVOIDFROMMP(mpParm2);
mrReply = WinSendMsg(ppsnSelect->hwndBook,
BKM_QUERYPAGEWINDOWHWND,
MPFROMLONG(ppsnSelect->ulPageIdNew),
0);
hwndPage = (HWND)PVOIDFROMMR(mrReply);
Once we have the window handel, we uery for the ID of the new top page.
If the ID belongs to the dialog, IDD_PERSONAL, we set the focus to the
first entry field, IDE_NAME. Otherwise, we know the dialog is the
TEAMOS2 dialog, and we set the focus to the first entry field in that
dialog, IDE_TEAMOS2.
usDlgId = WinQueryWindowUShort(hwndPage, QWS_ID);
if (usDlgId == IDD_PERSONAL)
{
WinSetFocus(HWND_DESKTOP,
WinWindowFromID(hwndPage, IDE_NAME));
} else {
WinSetFocus(HWND_DESKTOP,
WinWindowFromID(hwndPage, IDE_TEAMOS2));
} /* endif */
The notebook is created using WinCreateWindow
after the client area has been created.
hwndNotebook = WinCreateWindow(hwndWnd,
WC_NOTEBOOK,
"",
BKS_SPIRALBIND | BKS_SQUARETABS | BKS_STATUSTEXTCENTER,
0,
0,
rclClient.xRight,
rclClient.yTop,
hwndWnd,
HWND_TOP,
ID_NOTEBOOK,
NULL,
NULL);
[ Next ] [ Previous ] | Chapter 22 |