Re: [gtk-list] Style/Theory



Sean Cody wrote:
> 
> Where would one store the data applicable to a particular window/widget?
> Let's just say I have a fictitious program which has an entry widget and a
> button.  When the button is clicked the program is to preform a set of
> operations on the entry widget.  Another call back for this entry widget
> would be say on key press or something like that to check to see of the key
> pressed is the enter '\13' key signalling input completion.
> 
> How would the call back know what widget is being referred to? Would the
> char* or the entry widget be global (which doesn't sound nice).  Though what
> about larger input areas with multiple input fields?  How would the button
> call back know where the entry widget is to retrive the data (assuming that
> is is created in a local variable in a dialog creation function)...
> 
> Am I making sense? I completely understand the idea of call backs and
> attaching them to certain events though I don't understand how one would
> connect the data to this system. (I guess I am used to the object-oriented
> model ob embedding the data manipulation inside "window" or am I completely
> off base).
> 
> Any ideas or suggestions? (I have read through the Harllow book and the
> online GTK tutorial but this "little" descrepancy is blocking my mastery of
> GTK (which completely impresses me)).
> 

Along these lines, I've been using GTK--, and an OO approach in C++ to
separate the model/view, much as was done with the original Smalltalk 80
framework (which also included the concept of the controller). In the
same way that GTK+ models an OO approach in C, the same concept could be
carried to a decoupling of the model (roughly, your data) and view
(roughly, your widgets). I haven't done it, but would be the theoretical
start of my approach.

-- 

Rick L. Vinyard, Jr.



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