home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / CNRBAS.ZIP / CNRBASE.DOC < prev    next >
Text File  |  1993-03-27  |  5KB  |  92 lines

  1. CNRBASE.EXE is a sample program that demonstrates setting up a container
  2. control. It takes as a parameter a directory name. If no directory name is
  3. specified on the command line, the current drive/directory is used.
  4.  
  5. CNRBASE creates a standard window with a container as a child of the client
  6. window. Once created, the files found in the directory are inserted into the
  7. container and any subdirectories are traversed and inserted into the container
  8. in a tree format.
  9.  
  10. A secondary thread is employed to fill the container since filling it could
  11. take a while depending on what directory was specified. This allows the user
  12. to interact with the container while it is being filled.
  13.  
  14. This sample is meant to demonstrate the setting up of a container and nothing
  15. more. Drag/drop, Context Menus, Shared records, Deltas, Ownerdraw are just some
  16. of the things *not* covered here. I hope to upload a sample with these features
  17. at a later date.
  18.  
  19. My coding style uses extensive error-checking. If this is not your style and/or
  20. you feel it gets in the way of your understanding of the container setup, I
  21. uploaded CNREZ.ZIP that covers container setup using a single source module and
  22. no error checking. This may serve as better sample code. I intend to upload a
  23. program that demonstrates more advanced features of a container. That program
  24. will build on CNRBASE.
  25.  
  26. The following displays the initialization of the container as it relates to
  27. the 4 source modules that make up CNRBASE.EXE. The extern functions in the
  28. source modules are shown.
  29.  
  30.  
  31.   PRIMARY THREAD                           SECONDARY THREAD
  32.  
  33. ┌────────────────────┐                    ┌─────────────────────────────┐
  34. │           ┌────────┤                    │                             │
  35. │ CNRBASE.C │        │        (4)         │         POPULATE.C          │
  36. │   │  │    │       <─UM_CONTAINER_FILLED───────────                    │
  37. ││  │  │    │WinProc │                    │                             │
  38. ││  │  │    │        │                    │  ┌─> PopulateContainer()    │
  39. ││  │  │    │        │                    │  │                          │
  40. └│──│──│────┴────────┘                    └──│──────────│───────────────┘
  41.  │  │  │                                     │          │
  42.  │  │ (1)                                    │          │
  43.  │  │  │                                     │          │
  44.  │ (2) │                                     │          │
  45.  │  │  │                                     │          │
  46. ┌│──│──│────────────────────────┐            │          │
  47. ││  │  │                        │       _beginthread()  │
  48. ││  │  │    CREATE.C            │            │          │
  49. ││  │  │                        │            │          │
  50. ││  │  │                        │            │          │
  51. ││  │  └─> CreateDirectoryWin() │            │          │
  52. ││  │                           │            │          │
  53. ││  └─> CreateContainer() ────────────(3)────┘          │
  54. ││                              │                       │
  55. └│──────────────────────│───────┘                       │
  56.  │                      │                               │
  57.  │                   ┌──│───────────────────────────────│───┐
  58.  │                   │  v                               v   │
  59.  │                   │                                      │
  60.  │                   │              COMMON.C                │
  61.  └──────────────────────>                                   │
  62.                      │                                      │
  63.                      │     SetWindowTitle()                 │
  64.                      │     Msg()                            │
  65.                      │                                      │
  66.                      └──────────────────────────────────────┘
  67.  
  68.  
  69. (1) - Create the frame/client window.
  70. (2) - Create the container window as a child of the client.
  71. (3) - Start a thread that will fill the container with records.
  72. (4) - When the thread has filled the container, it posts a UM_CONTAINER_FILLED
  73.       message to the client window.
  74.  
  75.  
  76. Hope this sample program helps someone.
  77.  
  78. ===============================================================================
  79. GLOBAL HISTORY (KEPT SINCE 1/31/93 - Before that, kept on a per-module basis)
  80.  
  81. 3-27-93 - Changed PSZ szArg[] to char *argv[] in cnrbase.c because of 3/93
  82.           compiler bug.
  83.  
  84. ===============================================================================
  85.  
  86. Rick Fishman
  87. Code Blazers, Inc.
  88. 4113 Apricot
  89. Irvine, CA 92720
  90.  
  91. CIS ID: 72251,750
  92.