Forums › Forums › SIMPOL Programming › Why is my onlostfocus event handler being invoked…
- This topic has 11 replies, 2 voices, and was last updated 14 years, 5 months ago by Jim Locker.
- AuthorPosts
- December 10, 2009 at 7:14 am #324Jim LockerMember
…when my combo box gets focus? I give it focus programmatically, and the onlostfocus event is instantly called. This is messing things up badly.
December 10, 2009 at 8:06 am #1570Jim LockerMemberSome more information.
When I tab into a wxformcombo, the onlostfocus event handler is invoked.
If I enter the wxformcombo using the mouse and clicking into it, the
onlostfocus event handler is NOT invoked until the control loses focus 9as
it should be).December 10, 2009 at 4:14 pm #1676MichaelKeymasterJim wrote:
> Some more information.
>
> When I tab into a wxformcombo, the onlostfocus event handler is
> invoked. If I enter the wxformcombo using the mouse and clicking into
> it, the onlostfocus event handler is NOT invoked until the control
> loses focus 9as it should be).I will have to investigate this. I am not familiar with any situation
where this would normally be happening. The rule is that generally,
programmer-generated events should not cause events to fire, only
user-originated events should make the events fire.If you have a small reproducible, that would help greatly.
Ciao, Neil
December 10, 2009 at 4:35 pm #1819Jim LockerMemberI will see if I can construct one.
December 10, 2009 at 5:28 pm #1465Jim LockerMemberI just sent you a test case that does it.
December 11, 2009 at 2:25 pm #1524MichaelKeymasterJim wrote:
> I just sent you a test case that does it.
>Hi Jim,
I checked this, and you are right, it is happening. I discovered that if
you change the comobo to a droplist, it doesn't happen. I suspect that
the problem is that since it is a dropedit, focus is hitting the combo
part, then ending up in the edit part (which is really a separate
control), causing the onlostfocus to fire. I will see if I can get this
fixed, but as a workaround, if viable, switch to a droplist version.Ciao, Neil
December 11, 2009 at 4:45 pm #1822Jim LockerMemberI have dropedit for a reason. Can't switch to a droplist.
I put a toggle in the ongotfocus routine, toggling a reference variable.
If the toggle is set, the onlostfocus routine does nothing but clear the
toggle. This prevents the infinite loop, and certainly prevents the
routine from doing anything else when invoked on the entry to the combo
box.It is a kludgy workaround, but it lets me keep moving forward.
December 14, 2009 at 12:03 am #1823Jim LockerMemberThis is a huge problem for me. I have a lot of these dropedits in my
forms (as well as some droplists) and I can't change my dropedits to
droplists.For the moment I am patching with a toggle, but since the behavior is
different between the keyboard and the mouse, the result is that I cannot
make these things behave in a consistent fashion, and it is very
noticeable.I can patch while I develop, but I can't deploy this way. At that point,
this will be a show stopper.December 15, 2009 at 7:51 pm #1434Jim LockerMemberI have found a patch that appears workable.
I move the onlostfocus event to onselchange.
Upon entry to the function, the first thing I do is test to see if me.text
== me.gettext(). If it does, do nothing.If they don't match, a selection has been made so process it. At the end
of processing it, if there have been no errors, execute this line:
me.settext(me.gettext()) and the routine won't execute successfully again
until another change is made.Result is that the routine executes once-only (which is what I want
anyway).December 15, 2009 at 8:54 pm #1712Jim LockerMemberWell…not as workable as I thought.
It keeps the control from going crazy, but keyboard input is being ignored
altogether. *sigh*December 16, 2009 at 8:21 pm #1596MichaelKeymasterJim wrote:
> Well…not as workable as I thought.
>
> It keeps the control from going crazy, but keyboard input is being
> ignored altogether. *sigh*
>I have upgraded this one and it is being looked at. It is reproducible
here, so I hope for some proper resolution. Don't keep breaking your
head on it, for now.Ciao, Neil
December 16, 2009 at 9:48 pm #1827Jim LockerMemberWell, I'm glad to hear that.
I have a LOT of these edit combo boxes on my forms, and they are rather
central to the functionality of the entire system – to the point where I
literally cannot avoid them if I want to continue this translation effort.
So, even if they are not working right, I have to patch things enough to
get them working somehow so that I can execute those code branches. If I
can't execute those branches, nothing at all will work.Presently, that is what I am doing. I can execute the branches that need
to be executed; I just have to deal with the funky functionality that is
coming with the broken control. In-house, I can live with it for now. I
just can't deploy this.For reference, I am now about 7,000 lines into a 70,000 line conversion
effort. Given the changes in architecture that Simpol permits, I think I
am closer to 15% done than to 10%, but this give an idea of how far I have
to go. - AuthorPosts
- You must be logged in to reply to this topic.