Browse Prior Art Database

Standard Listbox Indexing

IP.com Disclosure Number: IPCOM000121999D
Original Publication Date: 1991-Oct-01
Included in the Prior Art Database: 2005-Apr-04
Document File: 3 page(s) / 95K

Publishing Venue

IBM

Related People

Jefferson, KJ: AUTHOR [+3]

Abstract

This article discusses a technique to determine the indexing for listbox items in a standard Presentation Manager* (PM) listbox. Because a listbox only returns selection notification when actions are taken, the application must determine the selection/deselection infomation as well as the corresponding listbox index. By providing extended Selection/Deselection processing for standard listboxs, selection/deselection, button 2 processing, and listbox item indexes can be passed to the application via a message.

This text was extracted from an ASCII text file.
This is the abbreviated version, containing approximately 52% of the total text.

Standard Listbox Indexing

      This article discusses a technique to determine the
indexing for listbox items in a standard Presentation Manager* (PM)
listbox.  Because a listbox only returns selection notification when
actions are taken, the application must determine the
selection/deselection infomation as well as the corresponding listbox
index. By providing extended Selection/Deselection processing for
standard listboxs, selection/deselection, button 2 processing, and
listbox item indexes can be passed to the application via a message.

      When a listbox item in a standard PM listbox is selected, a
selection notification is received in the WM_CONTROL message.
Unfortunately, there is no information as to which item within the
listbox the selection action was taken against.  In a single select
listbox, simply sending and processing the information from a
LM_QUERYSELECTION message will solve this problem. However, in the
case of a multi-select listbox, obtaining the index of the item being
processed is much more difficult.  The index, in addition to whether
the item was selected or deselected, is all left to the application.

      This set of problems can be overcome by subclassing the listbox
and processing much of the input information up front.  By doing
this, not only can the index of the listbox item being processed be
determined, selection/deselection and button2 processing can be
included in the notification sent back to the application.

      Subclass processing would take place in the following manner:
1. When a WM_BUTTON1DOWN, WM_BUTTON2DOWN, WM_BUTTON1DBLCLK,
WM_BUTTON2DBLCLK message is received, determine the index of the
listbox item as follows:
      a. Determine the y mouse position within the listbox (yPos).
      b. index = ((height LB) - yPos) / (height LB item) topindex
         (For a standard PM listbox, the height LB item is the
lMaxBaselineExt field in fontmetrics.)
2. After the index of the listbox is calculated, send and process a
LM_QUERYSELECTION against the listbox item to determine if the item
is seleced or deselected.
3. Send a message (WM_LB_CONTROL) to the owner of the listbox with
the following MPARAMs.
MP1 : SHORT1FROMMP(Listbox ID)
       SHORT2FROMMP(notification)
       LN_SELECT   - Sent when an item is selected
       LN_ENTER    - Sent when an item is entered
       LN_DESELECT - Sent when an item is deselected
       L...