wxFileConfig : read change on the fly ...

This forum can be used to talk about general design strategies, new ideas and questions in general related to wxWidgets. If you feel your questions doesn't fit anywhere, put it here.
Post Reply
Sylvain
In need of some credit
In need of some credit
Posts: 1
Joined: Mon Mar 07, 2005 8:09 am

wxFileConfig : read change on the fly ...

Post by Sylvain » Mon Mar 07, 2005 8:14 am

Hi Folks,

I have a little problem with wxFileConfig. I have 2 application, a setting application who write in config file, and a main application who read the setting write by setting application in config file. That work fine, if the writer write the settings before the start of main application. But if I change settings when the main application is running, that doesn't work. What is the way to read, or reload the config file on the fly ?

Thank by advance
regards
Sylvain

User avatar
Ryan Norton
Moderator
Moderator
Posts: 1319
Joined: Mon Aug 30, 2004 6:01 pm

Re: wxFileConfig : read change on the fly ...

Post by Ryan Norton » Tue Mar 15, 2005 7:49 am

Sylvain wrote:Hi Folks,

I have a little problem with wxFileConfig. I have 2 application, a setting application who write in config file, and a main application who read the setting write by setting application in config file. That work fine, if the writer write the settings before the start of main application. But if I change settings when the main application is running, that doesn't work. What is the way to read, or reload the config file on the fly ?

Thank by advance
regards
Sylvain
Interesting problem... I've had similar. Basically, IMHO the best way is to save the modification time using wxFileModificationTime, and check it periodically in your client app to see if its changed. If it has, reload the configuration...

Also note that you should close the config file right after you're done reading it, otherwise your other app amy not be able to write to it...
[Mostly retired moderator, still check in to clean up some stuff]

mjs
Experienced Solver
Experienced Solver
Posts: 93
Joined: Wed Feb 09, 2005 3:53 am
Contact:

Post by mjs » Sat Mar 19, 2005 12:44 pm

What about using IPC to notify all clients?

Regards,
Mark

Post Reply