1. Multiple lists and win32 lib

------=_NextPart_000_0006_01BFC8BA.0590A120
        charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Not sure if this one is a bug or just how windows works, but it could =
save someone a head ache or two!

If you set up a list and push button, and detect when someone clicks the =
list with onChange[ list_id ] =3D routine_id(" routine") then your =
routine gets called when the user clicks another control, such as the =
push button, if the list has been clicked once already, i.e. it calls =
the routine when you pick an item from the list, then AGAIN when another =
control gets focus (it would seem).

So here's a way around it :

procedure list_procedure()
    integer item

    item =3D getIndex (list)

    if item =3D 0 then
        --dummy line, kills the second call to this routine
    else
        --normal list code goes here
    end if

    setIndex (list, 0)

end procedure
onChange [list] =3D routine_id ("list_procedure")

------=_NextPart_000_0006_01BFC8BA.0590A120
        charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Dwindows-1252" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2722.2800" name=3DGENERATOR></HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT size=3D2>Not sure if this one is a bug or just how windows =
works, but=20
it could save someone a head ache or two!</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=3D2>If you set up a list and push button, and detect =
when someone=20
clicks the list with onChange[ list_id ] =3D routine_id(" routine") then =
your=20
routine gets called when the user clicks another control, such as the =
push=20
button, if the list has been clicked once already, i.e. it calls the =
routine=20
when you pick an item from the list, then AGAIN when another control =
gets focus=20
(it would seem).</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=3D2>So here's a way around it :</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=3D2>procedure list_procedure()</FONT></DIV>
<DIV><FONT size=3D2>&nbsp;&nbsp;&nbsp; integer item</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=3D2>&nbsp;&nbsp;&nbsp; item =3D getIndex =
(list)</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=3D2>&nbsp;&nbsp;&nbsp; if item =3D 0 then</FONT></DIV>
<DIV><FONT size=3D2>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; --dummy line, =
kills the=20
second call to this routine</FONT></DIV>
<DIV><FONT size=3D2>&nbsp;&nbsp;&nbsp; else</FONT></DIV>
<DIV><FONT size=3D2>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; --normal list =
code goes=20
here</FONT></DIV>
<DIV><FONT size=3D2>&nbsp;&nbsp;&nbsp; end if</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=3D2>&nbsp;&nbsp;&nbsp; setIndex (list, 0)</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=3D2>end procedure</FONT></DIV>
<DIV><FONT size=3D2>onChange [list] =3D routine_id=20

------=_NextPart_000_0006_01BFC8BA.0590A120--

new topic     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu