TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Erwin Hogeweg
from: Serge Ivanov
date: 1996-10-16 14:06:32
subject: Creating a Notebook from a dialogbo

Hello Erwin!

Replying to a message of Erwin Hogeweg to All:

 EH> I open a notebook dialog from an other dialog window but when I close
 EH> the notebook the application closes with it... (and it isn't redrawn
 EH> properly either).
   Solution depends on type of the notebook.  If it's like realworld notebook
(i.e. all pages has identical structure) simply create NOTEBOOK_CLIENT as child
of notebook window - don't send BKM_SETPAGEWINDOWHWND message.  If you create
properties like notebook, you must load dialogs - notebook's pages and send
BKM_SETPAGEWINDOWHWND to associate dialog with page.  After that set owner of
notebook page to notebook window.  By some reasons, notebook sets owner to
HWND_DESKTOP.  You may avoid this problem also by creating notebook window with
id != FID_CLIENT, but in this case you must care about notebook resizing...

------
DLGTEMPLATE IDD_SETTINGS 
{
 DIALOG "Settings", IDD_SETTINGS, ....
 {
  CONTROL "", FID_CLIENT, 0, 0, 228, 155, WC_NOTEBOOK,
              BKS_SPIRALBIND | BKS_BACKPAGESBR | BKS_MAJORTABRIGHT |
              BKS_SQUARETABS | WS_VISIBLE | WS_TABSTOP
 }
}

As you can see dialog loaded with single control - notebook and it has ID -
FID_CLIENT. (In this case frame handles all window resizing).  Notebook page
dialogs can be any.

-------
  /* Load pages */
  for(i = 0; i < num_of_pages; i++)
     {
      page_id = (ULONG)WinSendMsg(hwndNB, BKM_INSERTPAGE, NULL,
                            MPFROM2SHORT(BKA_AUTOPAGESIZE | BKA_MAJOR,
                            BKA_LAST));
      WinSendMsg(hwndNB, BKM_SETTABTEXT, (MPARAM)page_id, tabtext[i]);
      hwnd_dlg = WinLoadDlg(hwndNB, hwndNB,        // parent and owner
                            dlgpage[i].pfn,        // notebook page window func
                            0,
                            dlgpage[i].id,         // notebook page window ID
                            NULL);
      if(!hwnd_dlg ||
         !WinSendMsg(hwndNB, BKM_SETPAGEWINDOWHWND, (MPARAM)page_id,
                                 (MPARAM)hwnd_dlg))
         {
           WinDismissDlg(hwnd, 0);
         }
      else
         {
           WinSetOwner(j, hwndNB);
         }
     }
-------

   Bye, Serge!

--- FleetStreet 1.16+
* Origin: ...у нас есть знания на том беpегу... (2:5000/7.22)
SEEN-BY: 50/99 270/101 620/243 625/100 711/401 409 410 413 430 808 809 934
SEEN-BY: 711/955 712/407 515 624 628 713/888 800/1
@PATH: 5000/7 44 5020/400 443 79 5100/8 396/1 270/101 712/515 711/808 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.