1. Win32lib list selection
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 = #186, -- list box: set index of selected item
CB_SETCURSEL = #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 = window_handle[ id ]
-- get the message, based on control type
if window_class[ id ] = LB then msg = LB_SETCURSEL
elsif window_class[ id ] = CB then msg = CB_SETCURSEL
end if
-- send the message
dummy = c_func( xSendMessage, { hwnd, msg, item, 0 } )
end procedure
PS. Dear David Cuny, please add this to your list functions so I
don't have to keep editing! And on that note, might it be better to
name each successive (and eagerly awaited) version of Win32lib.ew
differently, say WinLib13, WinLib14, etc? I now have at least 5 copies
and I only started using them in earnest with version 0.10. They are
very hard to keep track of, and I hate to go back through all my little
programs checking for compatability each time a new version comes out.
Thanks!
John Cannon
2. Re: Win32lib list selection
John Z. Cannon wrote:
> ... wrote the following procedure
Thanks. It looks the same as what I put together for release in the next
version.
> ... please add this to your list functions so I
> don't have to keep editing!
That was the reason that I didn't post it to the list - I didn't want people
to be maintaining patched versions of Win32Lib.
> might it be better to name each successive (and eagerly awaited)
> version of Win32lib.ew differently, say WinLib13, WinLib14, etc?
That's a good plan for people to do on their end so the code doesn't blow up
with each new release. But I'll be sticking with the same name on the
releases for now.
Thanks for the feedback!
-- David Cuny
3. Win32lib list selection
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
4. Re: Win32lib list selection
David Cuny wrote:
>John Cannon wrote:
>> might it be better to name each successive (and eagerly awaited)
>> version of Win32lib.ew differently, say WinLib13, WinLib14, etc?
>That's a good plan for people to do on their end so the code doesn't blo=
w
up
>with each new release. But I'll be sticking with the same name on the
>releases for now.
>Thanks for the feedback!
>-- David Cuny
I immediately move each new version to the include directory, only keepin=
g
the zip files of older releases, in case there should be a bug
Ad