I have a fairly big application with a pTk interface. While writing this app, I began to wonder if I was doing the "right thing" when I designed the way different bits communicate.
The application is broken into several distinct interfaces, each has a "Manager" object that handles a specific set of related UIs, for example I have a DisplayManager that handles the details of creating and controlling various screens that display data, I also have a ConfigurationManager that handles the presentation of configuration screens. Each manager collects input from its children and then operates on the back-end objects, mostly through registered callbacks or eval-ing standard methods on child objects.
sub UpdatePanels { my $self = shift; my $net = $self->network; my @sensors = $net->sensors; my @display_objects = ( @{$self->display_objects} ); foreach my $display ( @display_objects ) { eval { $display->UpdatePanel( $self->session_state, @sensors ); }; warn $@ if $@; } } # END UpdatePanels
After further reading and experimentation, it seems to me that a better design might be to use Tk's event system to pass information.
sub UpdatePanels { my $self = shift; $self->eventGenerate('<<UpdatePanels>>'); }
Of course, I would need to create the UpdatePanel virtual event and bind a callback for each display object for this to work.
What I would like to know is:
TGI says moo
In reply to Perl Tk - propagating events by TGI
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |