Jump to content

PMGuide - Combination Box

From EDM2
Revision as of 19:40, 14 May 2024 by Martini (talk | contribs) (Created page with "{{IBM-Reprint}} {{PMGuide}} A combination box is two controls in one: an entry field and a list box. This chapter describes how to use combination-box controls, also called c...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Reprint Courtesy of International Business Machines Corporation, © International Business Machines Corporation

Presentation Manager Programming Guide and Reference
  1. How to Use this Book
  2. Device Functions
  3. Direct Manipulation Functions
  4. Dynamic Data Formatting Functions
  5. Hooks and Procedures
  6. Profile Functions
  7. Spooler Functions
  8. Window Functions
  9. Message Processing
  10. Data Types
  11. Errors
  12. Atom Tables
  13. Button Controls
  14. Clipboards
  15. Combination Box
  16. Container Controls
  17. Control Windows
  18. Cursors
  19. Dialog Windows
  20. Direct Manipulation
  21. Drawing in Windows
  22. Dynamic Data Exchange
  23. Entry-Field Controls
  24. File Dialog Controls
  25. Font Dialog Controls
  26. Frame Windows
  27. Hooks
  28. Initialization Files
  29. Keyboard Accelerators
  30. List-Box Controls
  31. Menus
  32. Messages and Message Queues
  33. Multiple-Line Entry Field Controls
  34. Mouse and Keyboard Input
  35. Mouse Pointers and Icons
  36. Notebook Controls
  37. Painting and Drawing
  38. Presentation Parameters
  39. Resource Files
  40. Scroll-Bar Controls
  41. Slider Controls
  42. Spin Button Controls
  43. Static Controls
  44. Title-Bar Controls
  45. Value Set Controls
  46. Windows
  47. Window Classes
  48. Window Procedures
  49. Window Timers
  50. Appendices
  51. Notices
  52. Glossary

A combination box is two controls in one: an entry field and a list box. This chapter describes how to use combination-box controls, also called combination boxes and prompted entry fields, to let the user choose and edit items from a list in PM applications.

About Combination-Box Controls

Combination-box controls enable the user to enter data by typing in the entry field or by choosing from a list in the list box. A combination-box control automatically manages the interaction between the entry field and the list box. For example, when the user chooses an item in the list box, the combination-box control displays the text for that item in the entry field. Then, the user can edit the text without affecting the item in the list box. When the user types a letter in the entry field, the combination-box control scrolls the list box contents so that items beginning with that letter become visible.

Combination-Box Styles

The following table shows the combination-box styles:

┌────────────────────┬────────────────────────────────────────┐
│Style Name          │Description                             │
├────────────────────┼────────────────────────────────────────┤
│CBS_SIMPLE          │Creates a simple combination box that   │
│                    │always displays its list box. The user  │
│                    │can enter and edit text in the entry    │
│                    │field or choose items from the list box.│
├────────────────────┼────────────────────────────────────────┤
│CBS_DROPDOWN        │Creates a drop-down combination box that│
│                    │displays its list box only if the user  │
│                    │clicks the drop-down icon at the right  │
│                    │end of the entry field. The             │
│                    │combination-box control hides the list  │
│                    │box when the user clicks the icon a     │
│                    │second time. In a drop-down combination │
│                    │box, the user can enter and edit text in│
│                    │the entry field or choose items from the│
│                    │list box.                               │
├────────────────────┼────────────────────────────────────────┤
│CBS_DROPDOWNLIST    │Creates a drop-down-list combination box│
│                    │that is similar to the drop-down        │
│                    │combination box, except that the user   │
│                    │can choose items only from the list box.│
│                    │The user cannot enter or edit text in   │
│                    │the entry field.                        │
└────────────────────┴────────────────────────────────────────┘

For combination boxes that have the CBS_DROPDOWN or CBS_DROPDOWNLIST styles, an application can display the list by using the CBM_SHOWLIST message.

An application can determine whether the list is already showing by using the CBM_ISLISTSHOWING message.

Applications also can use any of the entry-field (EM_) and list-box (LM_) messages with combination boxes. Entry-field messages affect the entry field; list-box messages affect the list box. For example, an application can use the LM_INSERTITEM message to insert items into the list box.

Combination-Box Notification Codes

A combination-box control sends WM_CONTROL messages containing notification codes to its parent window. These notification codes are similar to those sent by entry-field and list-box controls. A combination-box control sends a notification codes to its owner window.

Using Combination-Box Controls

You can create a combination box by using WinCreateWindow or by specifying a COMBOBOX statement in a dialog-window template in a resource file. When creating a combination box using WinCreateWindow, you must specify the predefined class WC_COMBOBOX. If you do not specify a style, the function uses the default styles WS_GROUP, WS_TABSTOP, and WS_VISIBLE.