Re: Example

From: Dmitry Karasik <>
Date: 10 Feb 2005 20:38:17 +0100

        Hi lemons!

On 10 Feb 05 at 18:51, "lemons" (lemons terry) wrote:

 lemons> I've been reading the Prima documentation, and have looked at the
 lemons> programming samples. But, I'm not seeing what I need. I need to
 lemons> = understand how to display a form, then close the form and open
 lemons> another form. = Also, I need an example of updating the same form
 lemons> with different information as = the Perl processing proceeds.

What is exactly you mean by a form? Is it a window with buttons, lists,
etc etc? If so, Prima contains a variety of similar forms in examples
and modules.

 lemons> Suggestions, please!

Well it's quite simple. Consider as a 'form' the standard
 color dialog, shown in examples/ . 'opening' here
would be either 'execute' call for modal display, or
'show' for modeless display. 'closing' will be 'close' or
'destroy' call. 'updating', if you mean that the widgets in
the window should reflect some new state, is straighforward
and is done by changing respective widget properties. For
example, let's make the color dialog change the button text
depending on the mouse position:

use Prima 'StdDlg', Application => { name => 'CV' };

my $button;
my $p = Prima::ColorDialog-> create(
  value => 0x3030F0,
  quality => 1,
  visible => 0,
  onMouseMove => sub {
        my ( $self, $mod, $x, $y) = @_;
        $button-> text( "$x:$y");

for ( $p-> widgets) {
        next unless $_-> text =~ /OK/;
        $button = $_;

$button-> onClick( sub {
        # close the window
        $p-> close;
        # quit the program
        $::application-> destroy;

$p-> show;

run Prima;

	Dmitry Karasik
catpipe Systems ApS
*BSD solutions, consulting, development
+45 7021 0050  
Received on Thu 10 Feb 2005 - 20:38:22 CET

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