I have an issue with Dispose() and popup controls that I''ve been trying to figure out but havn''t had any luck yet. Hopefully someone here can help. I''m using Syncfusion 22.214.171.124.
I have attached a small sample of a form containing two text boxes and a user control thats made up of a popup container and a popup control. This sample reproduces what I see in my real project, which is too large and complicated to include.
When I leave the user control I check to see if the data is valid in the OnEnter method of control about to be entered. If the user control''s data is not valid I want to focus back on it. Also, when I leave the user control, its popup control is disposed (as in the real app, to preserve resources). The dispose call is made in an async call using BeginInvoke. However, instead of the user control getting the focus back, Dispose calls SelectNextControl and the control after the user control will get the focus. If instead I call dispose syncronously, everything works as expected.
I''m sorry that the above explanation is confusing but if you open and run the attachment it will be much clearer.
- Run the project in the attachment
- Tab into the second control (thats the user control containing the popup)
- change its text so it doesn''t say "textBox1"
- Click the first control (the one you tabbed from)
- When this control is entered it checks the text of the user control. If it isn''t "textBox1" is sets the focus back to the user control.
- Instead of the user control getting the focus, the textbox after it gets the focus.
Comment out line 177 in MyPopupContainer and uncomment line 176 to see the correct behavior.
Please someone help me with this. I''ve been looking for the solution for a while now. I know it has something to do with async vs. sync and have a feeling that it has something to do with Dispose being called during a focus transfer. I''m not sure though if the popup controls do anything special in their Dispose calls.
I just want to understand the behavior I am seeing :)
Any help is greatly appreciated!
Thanks a lot.