Visual Builder question, method onClick

From: Tim Gimmel <tjg_at_gimmel.org>
Date: Wed, 24 Dec 2008 14:29:58 -0600
To: prima_at_prima.eu.org

I have just started using vb and am quite excited about using Prima,
however since I am a fairly new to Perl programming some of the docs are
tough going. I have a set of subs that I have already written to talk
to an Amateur Radio rig (Yaesu FT-950) I would like the buttons etc to
call my subs. However I am having trouble understanding how subs are
called. For example:

[...]
'Button3' => {
                class => 'Prima::Button',
                module => 'Prima::Buttons',
                profile => {
                        owner => 'GroupBox1',
                        name => 'Button3',
                        origin => [ 140, 132],
                        checkable => 1,
                        font => {name => 'Bitstream Vera Sans', size =>
10, style => 0, pitch =>
fp::Variable},
                        onClick => Prima::VB::VBLoader::GO_SUB('my $self
= $_[0];
','Button3', 'onClick'),
                        size => [ 56, 28],
                        text => '7 3',
        }},
        'Button15' => {
[...]

I am very unclear on how the onClick method works. The
  onClick => Prima::VB::VBLoader::GO_SUB('my $self = $_[0];
makes no sense to me and I have not been able to find the docs to
explain this method (clearly). Should "onClick => sub { mysub() }"
work, or is there other incantations missing? Here is the calling code:

#!/usr/bin/perl -w
use strict;
require "talkto950.pl"; #My subroutines

use Prima qw(Application Buttons);
use Prima::VB::VBLoader;
Prima::VBLoad( './FT950.fm',
    Form1 => { centered => 1 },
)-> execute;

Also do I need a "run Prima" statement? It appears the execute method
does the trick.

Sorry for the simple questions, but I need a kick start.

Happy Holidays!

Tim Gimmel
KY4J
Received on Wed 24 Dec 2008 - 21:46:49 CET

This archive was generated by hypermail 2.2.0 : Sat 19 Mar 2011 - 18:35:06 CET