1. broken buttons

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?

sequence leftButtonText,leftButtonProcess

    leftButtonText = {"E&XIT","&NEXT","&PREV","&FIND","&ADD"}
    leftButtonProcess = {"processExit","processNext","processPrev",
                         "processFind","processAdd"}
.
.
.
------------------------------------ Setup process
control --------------------------
    for i = 1 to length(lbt) do
        onClick[lbt[i]] = routine_id(leftButtonProcess[i])
    end for
    for i = 1 to length(rbt) do
        onClick[rbt[i]] = routine_id(rightButtonProcess[i])
    end for
.
.
----------------------------------- Exit
Button -------------------------------------
procedure processExit()
    closeWindow(Main)
end procedure


thanks for a hint...
george

new topic     » topic index » view message » categorize

2. Re: broken buttons

OHHH, you're right and this is a big impact on my programs..... I have
routines which I branch to with buttons, but I also call them directly and
now have no 3 arguments to pass since they don't need any input.....

george


----- Original Message -----
From: "Jonas Temple" <jtemple at yhti.net>
To: "EUforum" <EUforum at topica.com>
Subject: RE: broken buttons


>
>
> George,
>
> I ran into this as well.  If you're coming from a somewhat older version
> of Win32Lib then the problem might be that somewhere else in your code
> setHandler() was called, which turns off the old onXXX() event
> methodology.
>
> Now might be a good time to go through your code and migrate the onXXX
> to setHandler().
>
> HTH,
>
> Jonas
> George Walters wrote:
> >
> >
> > 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?
> >
> > sequence leftButtonText,leftButtonProcess
> >
> >     leftButtonText = {"E&XIT","&NEXT","&PREV","&FIND","&ADD"}
> >     leftButtonProcess = {"processExit","processNext","processPrev",
> >                          "processFind","processAdd"}
> > .
> > .
> > .
> > ------------------------------------ Setup process
> > control --------------------------
> >     for i = 1 to length(lbt) do
> >         onClick[lbt[i]] = routine_id(leftButtonProcess[i])
> >     end for
> >     for i = 1 to length(rbt) do
> >         onClick[rbt[i]] = routine_id(rightButtonProcess[i])
> >     end for
> > .
> > .
> > ----------------------------------- Exit
> > Button -------------------------------------
> > procedure processExit()
> >     closeWindow(Main)
> > end procedure
> >
> >
> > thanks for a hint...
> > george
> >
> >
> --^----------------------------------------------------------------
> This email was sent to: gwalters at sc.rr.com
>
>
> TOPICA - Start your own email discussion group. FREE!
>
>

new topic     » goto parent     » topic index » view message » categorize

3. Re: broken buttons

----- Original Message -----=20
From: "Jonas Temple" <jtemple at yhti.net>
To: "EUforum" <EUforum at topica.com>
Subject: RE: broken buttons


>=20
>=20
> George,
>=20
> Yep, you're right.  I also remembered the following "fix" if you don't =

> want to go through converting to setHandler.  Add this line of code=20
> right before WinMain():
>=20
> void =3D onXXX(True)
>=20

Yes, this is the technique to use while converting over to setHandler(). =
This works because each call to setHandler() also calls onXXX(False). =
Using both methods is a bit slower than just using setHandler.

On way of converting over is to this sort of thing...

---old code ---

procedure onClick_Btn()
  . . .
end procedure
onClick[Btn]=3Droutine_id("onClick_Btn")
. . .
  if xxx then
     onClick_Btn()
  end if

--converted code--

procedure onClick_Btn()
  . . .
end procedure
procedure Btn_Click(integer self, integer event, sequence parms)
   onClick_Btn()
end procedure
setHandler(Btn, w32HClick,routine_id("Btn_Click"))
. . .
  if xxx then
     onClick_Btn()
  end if
----------------

You can also invoke a handler using invokeHandler(Btn, w32HClick, {})

--=20
Derek

new topic     » goto parent     » topic index » view message » categorize

4. 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

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu