Re: Question on design

From: Dave Arnold <maillists_at_caledfwlch.me.uk>
Date: Tue, 31 May 2005 19:09:14 +0100
To: prima_at_prima.eu.org

In article
<A052A09408B33B4A90E5A3F9A532126202C221FF_at_corpmxgmm3.corp.emc.com>,
   <lemons_terry_at_emc.com> wrote:

> I tried to create a very simple application to illustrate what I'm
> seeing:

> use Prima qw(Application);
> my $main = Prima::Window -> new (text => 'Hello world!');
> # Display the window, then wait for and print some input
> $main -> show();
> $line = <STDIN>;
> print $line;
> # Hide the window, then wait for and print some input
> $main -> hide();
> $line = <STDIN>;
> print $line;
> # Display the window, then wait for and print some input
> $main -> show();
> $line = <STDIN>;
> print $line;
> # Destroy the window
> $main -> destroy();

> The behavior I see is that the show() call does create the window with
> the create text, but the hourglass cursor appears over the window, and
> none of the objects in the window are displayed.

> What have I forgotten?

You will need to pass control to the application to allow it to perform any
update actions, e.g. redrawing. This is achieved using:

$::application->yield();

Prima, like most GUI based toolkits are based around an "event loop" that
calls all the appropriate parts of the toolkit. This event loop is started
by Prima->run() and doesn't return until the application is closed.

If you are performing actions based on input from a file or socket you
might consider using the Prima::File object: this allows a routine to be
called when there is input available.

Dave.
Received on Tue 31 May 2005 - 20:10:11 CEST

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