Multi-list behavior under win32lib

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

This is a multi-part message in MIME format.

------=_NextPart_000_0007_01C0CB8F.EE79DEA0
	boundary="----=_NextPart_001_0008_01C0CB8F.EE79DEA0"


------=_NextPart_001_0008_01C0CB8F.EE79DEA0
	charset="iso-8859-1"

I am confident the following is a problem with win32lib (has this been =
fixed in later version of win32lib, I am using v0.50)?

Here is the sample code for those worried about viruses:

-- Under win32lib v0.50, the following behavior occurs using =
multi-select list boxes . . .
--=20
-- Gathering whether a user selected items in a multi-select list box =
gives
-- erroneous info using provided functions in win32lib.  Running the =
sample below showcases
-- this behavior.  The ability to check whether or not a user has =
selected anything is
-- because if this is not done before accessing the getMultItems(), an =
error occurs
-- within win32lib.
--
-- getIndex() works fine in a single select list box.
--=20
-- Please note: LB_GETANCHORINDEX works initially, but once an item is =
selected and then
--              deselected, LB_ANCHORINDEX remembers previous item =
selected and returns result

include win32lib.ew
without warning

constant
    Win        =3D create ( Window,       "Showcase Multi-List problem", =
            0, Default, Default, 300, 150, 0 ),
  Button1     =3D create ( PushButton,   "Use getIndex()",               =
         Win,     120,      10, 150,  30, 0 ),
  Button2     =3D create ( PushButton,   "Use LB_GETSELCOUNT",           =
         Win,     120,      60, 150,  30, 0 ),
  List1      =3D create ( SortedList,   "",                              =
        Win,      10,      10, 100, 100, LBS_EXTENDEDSEL )

addItem(List1, "> Item 1 <")
addItem(List1, "> Item 2 <")
addItem(List1, "> Item 3 <")
addItem(List1, "> Item 4 <")
addItem(List1, "> Item 5 <")
addItem(List1, "> Item 6 <")
addItem(List1, "> Item 7 <")

setEnable ( List1, False )

procedure onClick_Button1()
 atom test
 object result
=20
 test =3D getIndex( List1 )
  result =3D message_box (sprintf( "getIndex() still returns a value =
even though nothing is selected!: %d", test ), "Test multi-list", =
MB_ICONERROR+MB_TASKMODAL )       =20
end procedure

procedure onClick_Button2()
 atom test
 object result

 test =3D sendMessage(List1, LB_GETSELCOUNT, 0, 0)
  result =3D message_box(sprintf( "However, using LB_GETSELCOUNT =
provides the correct result: %d", test ), "Test multi-list", =
MB_ICONINFORMATION+MB_TASKMODAL )
end procedure

onClick [ Button1       ] =3D routine_id( "onClick_Button1" )
onClick [ Button2       ] =3D routine_id( "onClick_Button2" )

WinMain( Win, Normal )

------=_NextPart_001_0008_01C0CB8F.EE79DEA0
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 5.50.4134.600" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><FONT face=3DArial size=3D2>I am confident the following is a =
problem=20
with&nbsp;win32lib&nbsp;(has this been fixed in later version of =
win32lib, I am=20
using v0.50)?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Here is the sample code for those =
worried about=20
viruses:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3D"Courier New" size=3D1>-- Under win32lib v0.50, the =
following=20
behavior occurs using multi-select list boxes . . .<BR>-- <BR>-- =
Gathering=20
whether a user selected items in a multi-select list box gives<BR>-- =
erroneous=20
info using provided functions in win32lib.&nbsp; Running the sample =
below=20
showcases<BR>-- this behavior.&nbsp; The ability to check whether or not =
a user=20
has selected anything is<BR>-- because if this is not done before =
accessing the=20
getMultItems(), an error occurs<BR>-- within win32lib.<BR>--<BR>-- =
getIndex()=20
works fine in a single select list box.<BR>-- <BR>-- Please note:=20
LB_GETANCHORINDEX works initially, but once an item is selected and=20
then<BR>--&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;=20
deselected, LB_ANCHORINDEX remembers previous item selected and returns=20
result</FONT></DIV>
<DIV><FONT face=3D"Courier New" size=3D1></FONT>&nbsp;</DIV>
<DIV><FONT face=3D"Courier New" size=3D1>include win32lib.ew<BR>without=20
warning</FONT></DIV>
<DIV><FONT face=3D"Courier New" size=3D1></FONT>&nbsp;</DIV>
<DIV><FONT face=3D"Courier New" size=3D1>constant<BR>&nbsp;&nbsp;&nbsp;=20
Win&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =3D create (=20
Window,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "Showcase Multi-List=20
problem",&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;=20
0, Default, Default, 300, 150, 0=20
),<BR>&nbsp;&nbsp;Button1&nbsp;&nbsp;&nbsp;&nbsp; =3D create (=20
PushButton,&nbsp;&nbsp; "Use=20
getIndex()",&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;=20
Win,&nbsp;&nbsp;&nbsp;&nbsp; 120,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 10, =
150,&nbsp;=20
30, 0 ),<BR>&nbsp;&nbsp;Button2&nbsp;&nbsp;&nbsp;&nbsp; =3D create (=20
PushButton,&nbsp;&nbsp; "Use=20
LB_GETSELCOUNT",&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
Win,&nbsp;&nbsp;&nbsp;&nbsp; 120,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 60, =
150,&nbsp;=20
30, 0 ),<BR>&nbsp;&nbsp;List1&nbsp;&nbsp; &nbsp;&nbsp; =3D create (=20
SortedList,&nbsp;&nbsp;=20
"",&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;=20
Win,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 10,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 10, =
100,=20
100, LBS_EXTENDEDSEL )</FONT></DIV>
<DIV><FONT face=3D"Courier New" size=3D1></FONT>&nbsp;</DIV>
<DIV><FONT face=3D"Courier New" size=3D1>addItem(List1, "&gt; Item 1=20
&lt;")<BR>addItem(List1, "&gt; Item 2 &lt;")<BR>addItem(List1, "&gt; =
Item 3=20
&lt;")<BR>addItem(List1, "&gt; Item 4 &lt;")<BR>addItem(List1, "&gt; =
Item 5=20
&lt;")<BR>addItem(List1, "&gt; Item 6 &lt;")<BR>addItem(List1, "&gt; =
Item 7=20
&lt;")</FONT></DIV>
<DIV><FONT face=3D"Courier New" size=3D1></FONT>&nbsp;</DIV>
<DIV><FONT face=3D"Courier New" size=3D1>setEnable ( List1, False =
)</FONT></DIV>
<DIV><FONT face=3D"Courier New" size=3D1></FONT>&nbsp;</DIV>
<DIV><FONT face=3D"Courier New" size=3D1>procedure =
onClick_Button1()<BR>&nbsp;atom=20
test<BR>&nbsp;object result<BR>&nbsp;<BR>&nbsp;test =3D getIndex( List1=20
)<BR>&nbsp; result =3D message_box (sprintf( "getIndex() still returns a =
value=20
even though nothing is selected!: %d", test ), "Test multi-list",=20
MB_ICONERROR+MB_TASKMODAL )&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
<BR>end=20
procedure</FONT></DIV>
<DIV><FONT face=3D"Courier New" size=3D1></FONT>&nbsp;</DIV>
<DIV><FONT face=3D"Courier New" size=3D1>procedure =
onClick_Button2()<BR>&nbsp;atom=20
test<BR>&nbsp;object result</FONT></DIV>
<DIV><FONT face=3D"Courier New" size=3D1></FONT>&nbsp;</DIV>
<DIV><FONT face=3D"Courier New" size=3D1>&nbsp;test =3D =
sendMessage(List1,=20
LB_GETSELCOUNT, 0, 0)<BR>&nbsp; result =3D message_box(sprintf( =
"However, using=20
LB_GETSELCOUNT provides the correct result: %d", test ), "Test =
multi-list",=20
MB_ICONINFORMATION+MB_TASKMODAL )<BR>end procedure</FONT></DIV>
<DIV><FONT face=3D"Courier New" size=3D1></FONT>&nbsp;</DIV>
<DIV><FONT face=3D"Courier New" size=3D1>onClick [=20
Button1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ] =3D routine_id( =
"onClick_Button1"=20
)<BR>onClick [ Button2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ] =3D =
routine_id(=20
"onClick_Button2" )</FONT></DIV>
<DIV><FONT face=3D"Courier New" size=3D1></FONT>&nbsp;</DIV>
<DIV><FONT face=3D"Courier New" size=3D1>WinMain( Win, Normal=20

------=_NextPart_001_0008_01C0CB8F.EE79DEA0--

------=_NextPart_000_0007_01C0CB8F.EE79DEA0
Content-Type: application/octet-stream;
	name="Multi-list problem.exw"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="Multi-list problem.exw"

-- Under win32lib v0.50, the following behavior occurs using =
multi-select list boxes . . .
--=20
-- Gathering whether a user selected items in a multi-select list box =
gives
-- erroneous info using provided functions in win32lib.  Running the =
sample below showcases
-- this behavior.  The ability to check whether or not a user has =
selected anything is
-- because if this is not done before accessing the getMultItems(), an =
error occurs
-- within win32lib.
--
-- getIndex() works fine in a single select list box.
--=20
-- Please note: LB_GETANCHORINDEX works initially, but once an item is =
selected and then
--              deselected, LB_ANCHORINDEX remembers previous item =
selected and returns result

include win32lib.ew
without warning

constant
    Win		      =3D create ( Window,       "Showcase Multi-List problem", =
            0, Default, Default, 300, 150, 0 ),
		Button1     =3D create ( PushButton,   "Use getIndex()",               =
         Win,     120,      10, 150,  30, 0 ),
		Button2     =3D create ( PushButton,   "Use LB_GETSELCOUNT",           =
         Win,     120,      60, 150,  30, 0 ),
		List1   	  =3D create ( SortedList,   "",                              =
        Win,      10,      10, 100, 100, LBS_EXTENDEDSEL )

addItem(List1, "> Item 1 <")
addItem(List1, "> Item 2 <")
addItem(List1, "> Item 3 <")
addItem(List1, "> Item 4 <")
addItem(List1, "> Item 5 <")
addItem(List1, "> Item 6 <")
addItem(List1, "> Item 7 <")

setEnable ( List1, False )

procedure onClick_Button1()
	atom test
	object result
=09
	test =3D getIndex( List1 )
  result =3D message_box (sprintf( "getIndex() still returns a value =
even though nothing is selected!: %d", test ), "Test multi-list", =
MB_ICONERROR+MB_TASKMODAL )       =20
end procedure

procedure onClick_Button2()
	atom test
	object result

	test =3D sendMessage(List1, LB_GETSELCOUNT, 0, 0)
  result =3D message_box(sprintf( "However, using LB_GETSELCOUNT =
provides the correct result: %d", test ), "Test multi-list", =
MB_ICONINFORMATION+MB_TASKMODAL )
end procedure

onClick [ Button1       ] =3D routine_id( "onClick_Button1" )
onClick [ Button2       ] =3D routine_id( "onClick_Button2" )

WinMain( Win, Normal )
------=_NextPart_000_0007_01C0CB8F.EE79DEA0--

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

Search



Quick Links

User menu

Not signed in.

Misc Menu