Re: how to use .fm files

From: Dmitry Karasik <dmitry_at_karasik.eu.org>
Date: 09 Jan 2002 15:12:29 +0100
To: prima_at_prima.eu.org

        Hi Thomas!

On 08 Jan 02 at 23:23, "Thomas" (Thomas Wolf) wrote:
 Thomas> Hi there,

 Thomas> I'm very new to Prima and perl-GUI programming - can anybody give
 Thomas> me an example how to use the .fm files generated by VB ?

 Thomas> Thanks in advance Thomas

This must go to FAQ, I think.
Wait, we've got no FAQ! :)

Here's the excerpt of my old letter with .fm stuff explanation.

==cut==

Usually, for development reasons, you don't want to include
the content of .fm file into your source, because you'll
never be able to load it into VB afterwards.
Well, of course, you can (it's perl after all), but it would require
more coding.
Instead, inside your program you load the separate .fm file, using
standard code technique,
found, for example, in Prima/PS/Setup.pm ( I agree, it is not an example
but an obsfucated place for it ).

But in short, here it is:

     require Prima::VB::VBLoader;

or 'use', as you like. Prima::PS::Setup is an infrequent module, and
does not want to increase start-up
loading time. Does it on-demand.

     my $fi = Prima::find_image( 'Prima::PS', 'setup.fm');
     unless ( defined $fi) {
       Prima::message( "Cannot find resource: Prima::PS::setup.fm");
return
     }

find_image() traverses the perl installation directory. helpful if you
install
your program into perl tree, and let the user mangle with installation
path.
If you sure about the path where your .fm is located just give a full
path to it.
    
And at last:
   
     $dialog = Prima::VB::VBLoader::AUTOFORM_CREATE( $fi )-> {Form1};

AUTOFORM_CREATE returns all your widget in a hash bunch. Usually a form
is enough.
You can specify different parameters to it, like,

    $dialog = Prima::VB::VBLoader::AUTOFORM_CREATE( $fi,
       Form1 => {
         visible => 0,
         centered => 1,
       },
    )-> {Form1};

will made your dialog hidden before it's ready to use and centered, etc
etc. And, eventually
you can do

    $dialog-> execute;

 or

    $dialog-> show;

as you like. The syntax of AUTOFORM_CREATE allows powerful things to do,
but
can be reduced to as simple as content of Prima/VB/starter.pl, and still
work.

Hope this helps.

==over==

-- 
Sincerely,
	Dmitry
--- www.karasik.eu.org ---
Life ain't fair, but the root password helps.
                      - BOFH
Received on Wed 09 Jan 2002 - 15:14:05 CET

This archive was generated by hypermail 2.2.0 : Wed 27 Mar 2013 - 10:40:21 CET