Hi,
I’m experiencing various problems with a custom control class I built using the web search field control, “textchange” and “keypressed” events. The main issue is that the “keypressed” event stops responding. It happens when a second instance of it is created. A typical situation would be : the webdialog that contains the custom web search field control is opened, keypressed responds. The webdialog is closed and re-opened or a different webdialog using this same custom control is opened and then the keypressed event won’t respond.
When the webdialog is closed, it is set to Nil and a new instance is created at opening.
The user has to restart the application to make it work again.
I noticed that if the web search field is “de-enabled” and “re-enabled” then it works again once and stops working again after.
What should I do to solve this issue?
Thanks!
Does this only happen on a WebDialog? Those seem to be buggy.
Can you recreate the issue on a WebDialog using the regular web search field control?
Is your control a subclass of the search field, or did you go all in and make a control with WebControlWrapper?
Hi Tim, thanks for looking at my issue.
My custom control is in a container in webdialogs only… Can’t tell if the issue can be replicated elsewhere. I’ll try directly on a web page to check that out.
My control is a subclass of the search field. I only added three event handlers to it : Keypressed, TextChanged and Open.
Honesttly, I don’t know how to use WebControlWrapper… Maybe it is time I get into those…
I temporarily put a button by my control to trigger the filtering of the list which should be done when the user presses enter.
I tried my control on a web page and it shows the same behaviour. Does not seem to be related to the webdialog…
Okay you’ve got one source of issues out of the way - it’s not WebDialog.
Now you should find out if it’s your code or a bug in the framework by attempting to re-create the issue using a non-subclassed search field.
When you find that out, if it’s a framework bug submit a feedback report. If it’s something do do with your subclass, come back here, post your code, and we’ll attempt to debug it
I would start by testing plain old SearchField. Then if it works fair, something in the subclass is not right.
I did try with the search field from the library. I’ve put a search field with the following three event handlers : open, textChanged and keyPressed on a webdialog and copied it on another one
Code used in the event handlers.
open
None
textChanged
[code]
If Me.Text = “” Then
//populateClients
End If
Me.SetFocus
[/code]
keyPressed
Select Case details.KeyCode
Case details.KeyEnter
//populateClients
Me.SetFocus
Case Details.KeyEscape
Me.Text = ""
End Select
After writing, deleting text and hitting enter key in both search fields, it stops triggering the “keyPressed” event but not the textChanged event.
Correction : The textChanged event might stop as well…
Congratulations. You found a new bug. May I suggest you file a bug report.
As a workaround, you could try a standard WebTextField with &u0E11A (reading lens) as cue text. Hopefully it will not present the same bug.
Thanks Michel, I’m happy I did!
I’ll do as you suggest. I’ll also report the bug. Should I create an example to reproduce it? I just can’t send the project I’m working on…
It is best to create a small example.