Combo-Box Drop-Down Trigger?

dkellgren

Member
I want to increase the width of a combo box (to a 'fixed' width - I don't need dynamic) when the user drops down the cb list.

Is there an event trigger for that (like ON Drop-Down)? None of the standard obvious triggers handle this one.

Any help would be appriciated! :)
 

asereb

New Member
Portable Mouse Events

You can try to use Portable Mouse Events, like

MOUSE-SELECT-DOWN or
MOUSE-SELECT-CLICK
 
The cscombobox control c:\winnt\system32\cscomb32.ocx has both an ocx.dropdown and an ocx.closeup trigger.

Other than that, all I can suggest is using the Entry and Leave triggers.
 
A work around could be to use the msgBlaster OCX to trap the required event. This would mean you could still used the native combo-box.
 

dkellgren

Member
{windows.i}
&GLOBAL-DEFINE CB_SHOWDROPDOWN 335

DEFINE VARIABLE retval AS INTEGER NO-UNDO.

RUN SendMessage{&A} IN hpApi (INPUT COMBO-BOX-1:HWND,
{&CB_SHOWDROPDOWN},
1, /* True */
0,
OUTPUT retval
)
NO-ERROR /* Stop C Stack Errors */.
 

nborshukov

New Member
As your combo-box is static, you can set drop down list width once on window/dialog initialization or after you fill combo-box items, using Windows API function SendMessage:
Code:
&GLOBAL-DEFINE CB_SETDROPPEDWIDTH 352
PROCEDURE SendMessageA EXTERNAL "USER32.DLL":
    DEFINE INPUT  PARAMETER hwnd   AS LONG NO-UNDO.
    DEFINE INPUT  PARAMETER wmsg   AS LONG NO-UNDO.
    DEFINE INPUT  PARAMETER wparam AS LONG NO-UNDO.
    DEFINE INPUT  PARAMETER lparam AS LONG NO-UNDO.
    DEFINE RETURN PARAMETER rc     AS LONG NO-UNDO.
END PROCEDURE.

DEFINE VARIABLE res AS INTEGER NO-UNDO.
RUN SendMessageA (INPUT  cb-handle:HWND,
                  INPUT  {&CB_SETDROPPEDWIDTH},
                  INPUT  drop-down-list-width-pixels,
                  INPUT  0, /* zero */
                  OUTPUT res).
 
Top