Re: [gtkmm] MFC's UpdateData() equivalent ?



Gopal Sumathi (Princeton-intern) wrote:
Hi,
I'm translating GUI written using Windows MFCs to use GTKMM instead.
Is there a method equivalent to UpdataData() of MFC's Container class?
Basically this method can be used to copy displayed data into the associate widget-variable and vise-versa. When a method in the container class, it should be able to update variables of all its children.

In the same context, are there variables associated with widgets ? i.e. if its a Gtk::Entry , is there an associated variable, that holds associated data ?

There's no eqvivalent to MFC::CDialog::UpdateData. But thats not cexxesary, since you normally use a signal to retrive events on widgets. For the entry widget there is a signal for text change. The good thing is, that you can aassiciate to every signal connection a user defined value, e.g. a pointer, so all you've to do is writing a signal handler, that uses that value as a pointer to a string variable and copies the content of the widget into this variable. Then you just connect every widget to a variable via a unique signal handler. And you don't have to update the data manually, which is a common bug-source in the MFC.




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]