On Tue, Jan 08, 2002 at 11:23:58PM -0000, Thomas Wolf wrote:
> I'm very new to Prima and perl-GUI programming - can anybody give me
> an example how to use the .fm files generated by VB ?
Here's the method I prefer (which is definitely not the only one -
TIMTOWTDI). This method has an added advantage to allow a programmer to
enter the notification handling code in the `normal' programmer's text
editor, rather than using somewhat limited VB text editor.
my %w; # here all created widgets go, indexed by name
my @widgets = &{do "myform.fm"};
# this you might do without, but for completeness' sake:
my %classes_changes = (
some_widget_name => 'Some::Class::VB::Does::Not::Know::About',
another_widget_name => 'Another::Such::Class',
);
# everything you want to change/add to the widgets' profiles,
# including the notifications:
my %profile_changes = (
some_widget => {
visible => 0,
onClose => sub {
# bla bla
return 1;
},
},
some_button => {
onClick => sub {
# hlu hlu
},
},
some_listbox => {
multiSelect => 1,
# you get the idea....
},
);
# here we assume the right ordering in the .fm file
# if the ordering is not right (say, an owner comes before
# its child), some re-ordering should be done (and, in the
# long run, VB should be fixed).
while (@widgets) {
my ($name,$props) = (shift @widgets, shift @widgets);
# again, only if you need to override VB-generated classes
$props->{class} = $classes_changes{$name} if exists $classes_changes{$name};
@{$props->{profile}}{keys %{$profile_changes{$name}}} =
values %{$profile_changes{$name}} if exists $profile_changes{$name};
$props->{profile}->{owner} = $w{$props->{profile}->{owner}}
if exists $w{$props->{profile}->{owner}};
$w{$name} = $props->{class}->create( %{$props->{profile}});
}
# here all the widgets are created...
Cheers,
\Anton.
-- | Anton Berezin | FreeBSD: The power to serve | | catpipe Systems ApS _ _ |_ | http://www.FreeBSD.org | | tobez_at_catpipe.net (_(_|| | tobez_at_FreeBSD.org | | +45 7021 0050 | Private: tobez_at_tobez.org |Received on Wed 09 Jan 2002 - 00:57:20 CET
This archive was generated by hypermail 2.2.0 : Sat 19 Mar 2011 - 18:35:04 CET