No announcement yet.

A Simple Problem with Listboxes

  • Filter
  • Time
  • Show
Clear All
new posts

  • A Simple Problem with Listboxes

    This is probably an easy one, but I'm new to the game....

    My program I'm writing uses a dialog that simply consists of
    a Listbox control, for selecting a company or industry
    listed there, with a double-click, plus an "OK" button to close
    without picking.

    I use the following in the callback to trap the double-clicked
    list item:

    IF CBCTLMSG=%LBN_DBLCLK THEN 'Select ind/corp. from Form4 list
    .... (etc.)
    END IF

    It works fine, unless the user opens another instance of the
    same Form4 dialog (which I use in a number of places). Once that
    occurs, I notice that, on the first instance of the dialog, I am
    no longer able to trap the double-click, even after closing
    the second. The "OK" button still works (using %BN_CLICKED in
    a different CALLBACK for Form4), but not the double-click.

    Is there any way to "revive" the ability to recognize the
    double-click in that situation, or is it simply bad programming
    form to allow the user to have multiple instances of the same
    dialog open at the same time? (I.e., maybe I should just kill
    the first Form4 dialog when the user opens a second copy of it?)


  • #2
    My impression is that Windows sees the double click and doesn't know which one to send it to...
    I've had this issue when I declare an identifier (Ie %MB_BUTTON1) with the same value...
    The other thing that I notice that always gets my attention to the problem is that the alt-key's dont' work (ie Alt-F, for Alt-File)...

    Probably a bad idea, might suggest things like this:
    %MAX_WINDOWS = 10
    %ID_LISTBOX1 = %WM_USER + 700
    %ID_LISTBOX2 = %WM_USER + 701

    And so on, but you'd still have to find a way to separate the values if you use the same code to build the dialog with..

    Scott Turchin
    True Karate-do is this: that in daily life, one's mind and body be trained and developed in a spirit of humility; and that in critical times, one be devoted utterly to the cause of justice. -Gichin Funakoshi