1. Simple win32lib question
How do [I] create a List Control using win32lib with the ability for users to
select more than one line? Ie, a multiselect listbox
Cheers,
(censored)
Join 18 million Eudora users by signing up for a free Eudora Web-Mail account at
http://www.eudoramail.com
2. Re: Simple win32lib question
On Wed, 21 Jun 2000 01:15:50 -1200, (censored) wrote:
>How do [I] create a List Control using win32lib with the ability for users
>to select more than one line? Ie, a multiselect listbox
The different listbox styles are:
constant
LBS_DISABLENOSCROLL = 4096,
LBS_EXTENDEDSEL = #800,
LBS_HASSTRINGS = 64,
LBS_MULTICOLUMN = 512,
LBS_MULTIPLESEL = 8,
LBS_NODATA = #2000,
LBS_NOINTEGRALHEIGHT = 256,
LBS_NOREDRAW = 4,
LBS_NOSEL = #4000,
LBS_NOTIFY = 1,
LBS_OWNERDRAWFIXED = 16,
LBS_OWNERDRAWVARIABLE = 32,
LBS_SORT = 2,
LBS_STANDARD = #A00003,
LBS_USETABSTOPS = 128,
LBS_WANTKEYBOARDINPUT = #400,
-- to create a multiple select listbox, use LBS_MULTIPLESEL
-- Example:
Win = create( Window, "Example", 0, Default, Default, 200, 200, 0 ),
Lstbox1 = create( List, "", Win, Win, 10, 10, 170, 100, LBS_MULTIPLESEL )
-- LBS_MULTIPLESEL -> String selection is toggled each time the user clicks
-- or double-clicks the string. Any number of strings can be selected.
-- Brian
3. Re: Simple win32lib question
> >How do [I] create a List Control using win32lib with the
> ability for users
> >to select more than one line? Ie, a multiselect listbox
>
> LBS_EXTENDEDSEL = #800,
> LBS_MULTIPLESEL = 8,
> -- to create a multiple select listbox, use LBS_MULTIPLESEL
> -- Example:
>
> Win = create( Window, "Example", 0, Default, Default, 200,
> 200, 0 ),
> Lstbox1 = create( List, "", Win, Win, 10, 10, 170, 100,
> LBS_MULTIPLESEL )
>
> -- LBS_MULTIPLESEL -> String selection is toggled each time
> the user clicks
> -- or double-clicks the string. Any number of strings can be selected.
>
> -- Brian
>
LBS_EXTENDEDSEL might be more what you're looking for. It's more of a
standard, where you can select multiple items using shift, control, etc.
A little digging turned these up, which you'll need to use to retrieve the
values selected:
LBS_GETSELCOUNT = #190
LBS_GETSELITEMS = #191
The following functions return either a list of values, or the indices of
the selections:
global function getMultIndices( integer id )
atom buffer, items, array
sequence selections
selections = {}
items = sendMessage(id, LBS_GETSELCOUNT, 0 ,0)
buffer = allocate_struct(items*4)
items = sendMessage(id, LBS_GETSELITEMS, items, buffer)
for i = items to 1 by -1 do
selections = prepend(selections, peek4u( buffer + (i-1) * 4) + 1 )
end for
free(buffer)
return selections
end function
global function getMultItems( integer id )
sequence selections
selections = getMultIndices( id )
for i = 1 to length(selections) do
selections[i] = getItem(id,selelctions[i])
end for
return selections
end function
Dave, how about adding this to win32lib?
Matt Lewis
4. Re: Simple win32lib question
Matthew Lewis wrote:
> Dave, how about adding [multiple selection for listboxes]
> to win32lib?
Looks good. I'll add it in. I'm in the process of moving, so bug me in about
a week and I'll try to get it out by then.
Thanks!
-- David Cuny