wxGetTextFromUser() very delayed return

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
User avatar
bsenftner
Experienced Solver
Experienced Solver
Posts: 85
Joined: Thu May 26, 2016 9:19 pm

wxGetTextFromUser() very delayed return

Post by bsenftner »

Working in C++ VisualStudio 2015, deploying to flavors of Windows & Linux, and using the latest wxWidgets.

I have a multi-window application, each window being a wxFrame containing a wxNotebook, with toolbars on the notebook pages, and the majority of the secondary windows being video players with a notebook showing logs associated with that window's video feed. Basically, this is a complex application with the ability for multiple window video players and an image gallery.

The main window's notebook has pages for 1) video window administration, 2) an image gallery, and 3) application maintenance.

My problem is with using wxGetTextFromUser(). I use it on the main window's Image Gallery notebook page for the user to enter the name of a new image when adding images to the Image Gallery. The problem is wxGetTextFromUser() does not always return when the user is finished using the dialog, sometimes the return is very delayed:
  • If no secondary windows are open, wxGetTextFromUser() returns as one would expect, immediately upon the user finishing with using the dialog;
  • If a secondary window is open (a video window, a wxFrame), the dialog pops as expected and the user can enter their string normally, but the calling routine does not receive control back unless video playback is active in the secondary window. The delay could be hours if the user waits that long to press the "Play" toolbar icon on this secondary window.
What would/could cause this wxGetTextFromUser() return value delay? I've (briefly) tried finding the source file to wxGetTextFromUser(), but I've not found it; I suspect there is some internal event loop that is not terminating... Any ideas?
User avatar
doublemax
Moderator
Moderator
Posts: 19116
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wxGetTextFromUser() very delayed return

Post by doublemax »

Does this happen on both Windows and Linux?
Do you pass something as parent to wxGetTextFromUser?
Will only playing a video make the call return, or any user activity in that window?

The source for wxGetTextFromUser is in \src\common\utilscmn.cpp and it just uses a wxTextEntryDialog. The source for that is in \src\generic\textdlgg.cpp. But i'm afraid there is nothing interesting to see. (BTW: I recommend AstroGrep, invaluable tool to find stuff in foreign sources: http://astrogrep.sourceforge.net/screenshots/ )
Use the source, Luke!
User avatar
bsenftner
Experienced Solver
Experienced Solver
Posts: 85
Joined: Thu May 26, 2016 9:19 pm

Re: wxGetTextFromUser() very delayed return

Post by bsenftner »

I am developing and debugging in Win10, so I have not tried Linux yet.

I pass in the main window as the parent to the wxGetTextfromUser().

Another developer, compiling the program separately, also sees wxGetTextFromUser()'s delayed return, but is able to get the return to occur by generating toolbar events on his main window. That behavior does not work with my compiles.

I'm looking at the source now (thanks for the guide there.) Where is the source for wxTextEntryDialog? I want to put copies in my sources and step thorough to figure out what is prevent them from returning.

BTW: I checked, and every usage of wxGetTextfromUser() in my application has this issue. About 5 places.
User avatar
doublemax
Moderator
Moderator
Posts: 19116
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wxGetTextFromUser() very delayed return

Post by doublemax »

Where is the source for wxTextEntryDialog?
Read my previous answer again. However, there is nothing interesting to see in it. I would expect this to happen with any wxDialog.

I haven't tried it yet, but i'm almost certain i won't see this issue when i create a minimal sample with a few wxFrames and do the same. Is there anything "special" about your code? Sorry, i can't be more specific, i'm not sure what i'm looking for.

BTW: If you have any custom paint event handler, make sure you create a wxPaintDC in it, even if you don't use it (e.g. for OpenGL). Windows will create neverending paint events if you don't.
Use the source, Luke!
User avatar
bsenftner
Experienced Solver
Experienced Solver
Posts: 85
Joined: Thu May 26, 2016 9:19 pm

Re: wxGetTextFromUser() very delayed return

Post by bsenftner »

Well, I must have had a "bad library compile" with my previous build, because a fresh download and rebuilding of the wxWidgets source works perfectly fine, as expected. I'd downloaded the source to build a step-wise debugging version, which I have now, but don't need anymore. (I'm sure a step-wise debug version will be useful later anyway.)

an as far as custom paint event handlers - already handed as a know issue some time ago.

Thanks doublemax!
Post Reply