
Mathew Robertson wrote:
The FOX GUI has exactly this capability, you can connect a variable directly to the widget, without requiring any glue code at all. In fact, you can connect the same variable to multiple widgets at the same time (eg a 'spinner' widget and an 'editeline'), without requiring the programmer to write any type of callback mechanism.
This works because all GUI events are bi-directional. For more information, read: http://www.fox-toolkit.org/datatarget.html
That seems a lot of code, compared to: http://www.torjo.com/win32gui/save_dlg.html Not to say about validation...
The problem with this implementation is that the 'user_name' field cannot (usually) connect to more than one widget at a time.
That is a current limitation, but I don't think you need it so much. Anyway, you can work around it, by listening to kill_focus events: - you will have temporary variables, and each is bound to a control. - You listen for kill_focus from these variables - on kill_focus, you synchronize the temporary variables
Also, most widget libraries dont allow you to connect a variable to a widget, and still allow user validation. This is because the widget library doesn't callback into the validation code, since it assumes that if it is connected to a widget, then no validation code is necessary.
That's the win32gui' advantage :) "if it is connected to a widget, then no validation code is necessary." - that really sounds silly. Best, John -- John Torjo, Contributing editor, C/C++ Users Journal -- "Win32 GUI Generics" -- generics & GUI do mix, after all -- http://www.torjo.com/win32gui/ -- v1.5 - tooltips at your fingertips (work for menus too!) + bitmap buttons (work for MessageBox too!) + tab dialogs, hyper links, lite html