Win32lib list selection

new topic     » goto parent     » topic index » view thread      » older message » newer message

John Cannon asked for a function to select an item from a list.
Look at lines 3088..3102 of Win32Lib.ew version 0.13.

Hope this helps!

Ad Rienks


Original message( part of it, at least):

Greetings!

How to select 1st item (or any other) in lists.  I tried and tried and
then decided that it was not yet supported in Win32lib.  So I went
searching and found the following two constants and wrote the following
procedure (with ample reference to exisiting Win32lib procedures and
with help of Borland's Win32 Help).

constant
   LB_SETCURSEL        =3D #186,     -- list box: set index of selected i=
tem
   CB_SETCURSEL        =3D #14E,     -- combo box: set index of selected =
item

global procedure setItem( atom id, integer item )

    -- set list box to highlight (select) the item with index item.  This=

is a
    -- zero-based list.  Using -1 deselects all items.

    integer hwnd, msg
    atom dummy

    -- get the list's handle
    hwnd =3D window_handle[ id ]

    -- get the message, based on control type
    if      window_class[ id ] =3D LB then msg =3D LB_SETCURSEL
    elsif   window_class[ id ] =3D CB then msg =3D CB_SETCURSEL
    end if

    -- send the message
    dummy =3D c_func( xSendMessage, { hwnd, msg, item, 0 } )

end procedure

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu