Mouse-Hover on Combo-Box Value

Posted by SHASHANK on 07-Oct-2018 01:31

Hello All,

Greetings,

I have a requirement to show the values of combo-box values list into a text type fill-in as a toolTip  on Mouse-hover(Not on click of combo-box value).

In above picture fill in should be showing "ccccccccccccccccccccccccc" instead of "bbbbbbbbbbbbbbbbbb"

Please suggest how i will achieve this,

Thanks

Shashank S. Singh

Posted by nborshukov on 08-Oct-2018 01:43

Hi Shashank,

Under Windows you can set combo-box drop down list width using Windows API. Here is a procedure, which can do job for you for list-items combo-box. It works with 32-bit OE. If you are using list-item-pairs combo-box you should modify it to manage item-pairs labels. You should call the procedure after combo-box is filled.

&GLOBAL-DEFINE CB_SETDROPPEDWIDTH 352

DEFINE INPUT PARAMETER cb-handle AS HANDLE NO-UNDO.

DEFINE VARIABLE n AS INTEGER NO-UNDO.
DEFINE VARIABLE a AS CHARACTER NO-UNDO INITIAL "A".
DEFINE VARIABLE wid AS INTEGER NO-UNDO INITIAL 0.
DEFINE VARIABLE i AS INTEGER NO-UNDO.
DEFINE VARIABLE res AS INTEGER NO-UNDO.
    
    n = cb-handle:NUM-ITEMS.
    IF n > cb-handle:INNER-LINES 
        THEN a = FILL("А",4). /* add some space for vertical scroll-bar */ 

    DO i = 1 TO n:
        wid = max(wid,FONT-TABLE:GET-TEXT-WIDTH-PIXELS(cb-handle:ENTRY(i) + a,cb-handle:FONT)).
    END.
    RUN SendMessageA (INPUT  cb-handle:HWND,
                      INPUT  {&CB_SETDROPPEDWIDTH},
                      INPUT  max(wid,cb-handle:WIDTH-PIXELS),
                      INPUT  0,
                      OUTPUT res).
    
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.

All Replies

Posted by nborshukov on 08-Oct-2018 01:43

Hi Shashank,

Under Windows you can set combo-box drop down list width using Windows API. Here is a procedure, which can do job for you for list-items combo-box. It works with 32-bit OE. If you are using list-item-pairs combo-box you should modify it to manage item-pairs labels. You should call the procedure after combo-box is filled.

&GLOBAL-DEFINE CB_SETDROPPEDWIDTH 352

DEFINE INPUT PARAMETER cb-handle AS HANDLE NO-UNDO.

DEFINE VARIABLE n AS INTEGER NO-UNDO.
DEFINE VARIABLE a AS CHARACTER NO-UNDO INITIAL "A".
DEFINE VARIABLE wid AS INTEGER NO-UNDO INITIAL 0.
DEFINE VARIABLE i AS INTEGER NO-UNDO.
DEFINE VARIABLE res AS INTEGER NO-UNDO.
    
    n = cb-handle:NUM-ITEMS.
    IF n > cb-handle:INNER-LINES 
        THEN a = FILL("А",4). /* add some space for vertical scroll-bar */ 

    DO i = 1 TO n:
        wid = max(wid,FONT-TABLE:GET-TEXT-WIDTH-PIXELS(cb-handle:ENTRY(i) + a,cb-handle:FONT)).
    END.
    RUN SendMessageA (INPUT  cb-handle:HWND,
                      INPUT  {&CB_SETDROPPEDWIDTH},
                      INPUT  max(wid,cb-handle:WIDTH-PIXELS),
                      INPUT  0,
                      OUTPUT res).
    
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.

Posted by SHASHANK on 08-Oct-2018 02:26

Thanks nborshukov, it is definitely helpfull for me.

Posted by SHASHANK on 08-Oct-2018 02:30

One more thing, Can we use mouse-hover event using WindowAPI, I did it using radControlls (in Telerik), but not sure how to do it in Progress Classic GUI widget.

Posted by nborshukov on 08-Oct-2018 08:52

I'm not sure you can use mouse-hover in classic Progress GUI.

This thread is closed