comp.lang.ada
 help / color / mirror / Atom feed
* Periodic screen update using GWindows/GNAT?
@ 2002-05-23 22:31 D
  2002-05-24  1:46 ` Randy Brukardt
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: D @ 2002-05-23 22:31 UTC (permalink / raw)


I'm new to Windows programming.

My environment is NT/GNAT/GWindows.

I can't quite figure out how to update a window asynchronously (i.e.
in a non-event driven way). I need to have a display in a window
update regularly, without the user doing anything. How do I do this
after I've called GWindows.Application.Message_Loop?

Thanks!



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Periodic screen update using GWindows/GNAT?
  2002-05-23 22:31 Periodic screen update using GWindows/GNAT? D
@ 2002-05-24  1:46 ` Randy Brukardt
  2002-05-24 17:27   ` David Botton
  2002-05-24 16:59 ` Stephen Leake
  2002-05-24 17:20 ` David Botton
  2 siblings, 1 reply; 5+ messages in thread
From: Randy Brukardt @ 2002-05-24  1:46 UTC (permalink / raw)


D wrote in message <8cd144a2.0205231431.6524993@posting.google.com>...
>I'm new to Windows programming.
>
>My environment is NT/GNAT/GWindows.
>
>I can't quite figure out how to update a window asynchronously (i.e.
>in a non-event driven way). I need to have a display in a window
>update regularly, without the user doing anything. How do I do this
>after I've called GWindows.Application.Message_Loop?
>
>Thanks!

Well, this is easy in Claw, because Claw is task safe. Just create a
task to do the display update, give the task a copy of the window to
write to, and write to the window as needed. The event loop is a
separate task, so you don't need to worry about it, and it doesn't block
the window updating. There is an example of doing that with Claw (look
at Adtest).

I don't believe GWindows is task-safe. (I'm sure David will correct me
if I'm wrong here...) That means that only a single task can write to
the windows, so you can't use the tasking solution (at least not without
standing on your head).

The Claw introductory edition is available for free under the GMGPL, see
http://www.rrsoftware.com/ for the download. (The license doesn't match
the GMGPL, that will get updated with the next update of the
Introductory edition; don't worry about that...)

                Randy Brukardt
                R.R. Software, Inc.






^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Periodic screen update using GWindows/GNAT?
  2002-05-23 22:31 Periodic screen update using GWindows/GNAT? D
  2002-05-24  1:46 ` Randy Brukardt
@ 2002-05-24 16:59 ` Stephen Leake
  2002-05-24 17:20 ` David Botton
  2 siblings, 0 replies; 5+ messages in thread
From: Stephen Leake @ 2002-05-24 16:59 UTC (permalink / raw)


ddave83@hotmail.com (D) writes:

> My environment is NT/GNAT/GWindows.
> 
> I can't quite figure out how to update a window asynchronously (i.e.
> in a non-event driven way). I need to have a display in a window
> update regularly, without the user doing anything. How do I do this
> after I've called GWindows.Application.Message_Loop?

I don't know how to do this in detail since I don't use GWindows, but
the canonical Windows approach is to create a timer, have it send your
window timer messages, and do the regular updates in the timer message
handler.

The Ada way is to use a separate task to do computations for the
regular updates, and pass the results to the window in a task-safe
way. If the computations are time-consuming, this is worth it
(assuming GWindows provides task-safe inter-window communications). If
the computations are fast, it is not worth it.

-- 
-- Stephe



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Periodic screen update using GWindows/GNAT?
  2002-05-23 22:31 Periodic screen update using GWindows/GNAT? D
  2002-05-24  1:46 ` Randy Brukardt
  2002-05-24 16:59 ` Stephen Leake
@ 2002-05-24 17:20 ` David Botton
  2 siblings, 0 replies; 5+ messages in thread
From: David Botton @ 2002-05-24 17:20 UTC (permalink / raw)


Put the drawing code in to a task :-) That's one of the best parts of using
Ada.

There is an example of this in:

gwindows\samples\tasks\thread_test.adb

David Botton

"D" <ddave83@hotmail.com> wrote in message
news:8cd144a2.0205231431.6524993@posting.google.com...
> I can't quite figure out how to update a window asynchronously





^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Periodic screen update using GWindows/GNAT?
  2002-05-24  1:46 ` Randy Brukardt
@ 2002-05-24 17:27   ` David Botton
  0 siblings, 0 replies; 5+ messages in thread
From: David Botton @ 2002-05-24 17:27 UTC (permalink / raw)


"Randy Brukardt" <randy@rrsoftware.com> wrote in message
news:uer6rdmi3ivk25@corp.supernews.com...
> Well, this is easy in Claw, because Claw is task safe. Just create a
> task to do the display update, give the task a copy of the window to
> write to, and write to the window as needed. The event loop is a
> separate task, so you don't need to worry about it, and it doesn't block
> the window updating. There is an example of doing that with Claw (look
> at Adtest).

Works the same way in GWindows for updates.

> I don't believe GWindows is task-safe. (I'm sure David will correct me
> if I'm wrong here...) That means that only a single task can write to
> the windows, so you can't use the tasking solution (at least not without
> standing on your head).

GWindows is Task Savy :-) As with Claw you can update/write to any window at
any time.

The only time tasking is more involved (for flexability reasons) is when
"creating" new controls in a window. There are examples of different methods
in the GWindows code for doing this in a manner that best fits your project.

David Botton





^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2002-05-24 17:27 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-05-23 22:31 Periodic screen update using GWindows/GNAT? D
2002-05-24  1:46 ` Randy Brukardt
2002-05-24 17:27   ` David Botton
2002-05-24 16:59 ` Stephen Leake
2002-05-24 17:20 ` David Botton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox