Textfile-Parser (wxThread) in a GUI Topic is solved

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
I live to help wx-kind
I live to help wx-kind
Posts: 192
Joined: Fri Dec 22, 2006 9:17 am
Location: Germany

Textfile-Parser (wxThread) in a GUI

Post by extreme001 » Mon Jun 08, 2009 12:31 pm

Hi wx-users!

I have a strange problem...i've coded an app with a gui with draggable controls on it. There's a timer which checks a textfile for changes. If the text-file was changed i use some wxRegEx's to parse the file and extract some informations. I ran into problems if there are many more lines to parse...let's say about 1000 lines...

I created the parser class derived from wxThread with a Entry() in it. In the entry()-Function the file is checked for changes...if changed, the import()-function is called. I call Entry() every 10 seconds...to check if the file was changed. If there are changes and the import()-Function is called it takes a long time. While importing i can't drag my controls aound, the gui is locked. How can i import in the background and move my controls ? Did i forget something?

Thanks for your help widgeters!

Site Admin
Site Admin
Posts: 6695
Joined: Thu Sep 28, 2006 12:23 am

Post by Auria » Mon Jun 08, 2009 2:28 pm

First of all... when you say you're calling Entry(), you're not actually calling Entry(), are you? Launch a thread using its start method (or whatever it's called), calling Entry() manually is wrong.

Also, GUI lockups often occur if you make GUI calls from another thread. Use events to communicate from your thread to the main GUI thread (see wiki, it has an example of how to do that... article is something like "inter-process and inter-thread communication")
"Keyboard not detected. Press F1 to continue"
-- Windows

Post Reply