Re: broken buttons
----- Original Message -----=20
From: "George Walters" <gwalters at sc.rr.com>
To: "EUforum" <EUforum at topica.com>
Subject: broken buttons
>=20
>=20
> I just upgraded to the latest win32 for come listView functions and =
most of
> my buttons are now broken. Here's some code snipits.. (I'm using EU =
2.3 if
> that might make a difference). The "exit" seems quite simple but it =
does not
> work any more..... Any Ideas on what changed?
Yes, you need to call onXXX(True) just prior to WinMain(...) This is =
because the library now assumes that setHandler() is the normal method =
and onXXX is being phased out.
> sequence leftButtonText,leftButtonProcess
>=20
> leftButtonText =3D {"E&XIT","&NEXT","&PREV","&FIND","&ADD"}
> leftButtonProcess =3D {"processExit","processNext","processPrev",
> "processFind","processAdd"}
> .
> .
> .
> ------------------------------------ Setup process
> control --------------------------
>
> for i =3D 1 to length(lbt) do
> onClick[lbt[i]] =3D routine_id(leftButtonProcess[i])
> end for
> for i =3D 1 to length(rbt) do
> onClick[rbt[i]] =3D routine_id(rightButtonProcess[i])
> end for
To convert this you could do something like ...
sequence onClick onClick =3D {} -- Overrides the global in =
win32lib.
procedure xfr_click(integer self, integer event, sequence parms)
call_proc(onClick[self],parms)
end procedure
for i =3D 1 to length(lbt) do
if lbt[i] > length(onClick) then
onClick &=3D repeat(-1, lbt[i] - length(onClick))
end if
onClick[lbt[i]] =3D routine_id(leftButtonProcess[i])
end for
for i =3D 1 to length(rbt) do
if lbt[i] > length(onClick) then
onClick &=3D repeat(-1, lbt[i] - length(onClick))
end if
onClick[rbt[i]] =3D routine_id(rightButtonProcess[i])
end for
setHandler(lbt&rbt, w32HClick, routine_id("xfr_click"))
> .
> ----------------------------------- Exit
> Button -------------------------------------
> procedure processExit()
> closeWindow(Main)
> end procedure
With the new win32lib, this can be made event more simpler. You delete =
these four lines ...
----- Exit Button ----------
procedure processExit()
closeWindow(Main)
end procedure
and on the create() for the button you add the flag value w32AUTOCLOSE =
thus...
btnExit =3D create(Button, "E&xit", Win, l,t,w,h, w32AUTOCLOSE)
and that's it. =20
=20
--=20
Derek
|
Not Categorized, Please Help
|
|