RE: onChange Bug

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

At 08:07 PM 07/08/2002 +0000, Jonas wrote:
Jonas is correct.  This is not a bug in with win32lib,
it is a fundamental issue with the way the win32 message
que works.  I have seen the same thing discussed in many
VB forums.

Basically, any code that fires when a control changes states
(message fields, buttons, etc) should not also modify the state
of that control without a way to prevent a recursive loop.

James Powell
>Jon,
>
>I've run into this as well.  I'm not sure it's a bug and here's why.
>The onchange event is fired whenever the control is changed.  In your
>routine, you're changing the edit control, which fires the onchange
>event, which changes the control, which fires the event, etc., etc. and
>eventually makes exw crash because of the large call stack.
>
>I've gotten around this in the past (and if someone has a better idea,
>please) by putting a flag in my program that I set and then not change
>if it is set.  For example:
>
>atom changing
>changing = False
>
>procedure onChangeEditBox()
>
>if not changing then
>changing = True
>setText( EDIT_BOX, "new text")
>changing = False
>end if
>
>end procedure
>onChange[ EDIT_BOX] = routine_id( "onChangeEditBox")
>
>This stops the recursive call.  It may not be the best way around the
>problem but it works for me.
>
>Jonas
>
>Jon Snyder wrote:
> >
> >
> > There is a bug in Win32Lib v57 with trying to call setText( within a
> > onChange event.
> >
> > Is there a way to fix this or should i just use the older win32lib?  Or
> > is there a newer version that doesn't have this bug?
> >
> > Here is an example..
> >
> > -- This is not the actual code
> > procedure onChangeEditBox()
> >
> > setText( EDIT_BOX, "new text")
> >
> > end procedure
> > onChange[ EDIT_BOX] = routine_id( "onChangeEditBox")
> >
> > This makes an error in exw.exe
> >
> > Thanks, Jon

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

Search



Quick Links

User menu

Not signed in.

Misc Menu