RE: Question on design

From: <lemons_terry_at_emc.com>
Date: Tue, 31 May 2005 15:44:21 -0400
To: prima_at_prima.eu.org

Hi Dave

Thanks very much for the reply, and the suggestion. I've been experimenting
with $::application->yield();, and have achieved some different results.
But the application still isn't working as I'd like.

Where should I place the '$::application->yield();' line, and how many of
them do I need?

Thanks
tl

-----Original Message-----
From: owner-prima_at_prima.eu.org [mailto:owner-prima_at_prima.eu.org] On Behalf
Of Dave Arnold
Sent: Tuesday, May 31, 2005 2:09 PM
To: prima_at_prima.eu.org
Subject: Re: Question on design

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 - 21:44:30 CEST

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