Hi all,
I’ve got a Photon client app that displays a message in a PtLabel using
PtSetResource(), then does a MsgSend() to a neutrino server. It then waits
for a reply from the server before hiding the message in the PtLabel
(PtSetResource() changes the label’s colour to the background colour). All
this is done in the same Activate callback attached to a PtButton). Here’s a
rough sketch of the code:
PtSetResource( label, text_string, text ) /* set message /
PtSetResource( label, color, white ) / show message /
MsgSend( ) / wait for reply /
PtSetResource( label, color, black ) / hide message */
However, the second PtSetResource() is not working – the message remains
visible until it is overwritten by the next visible message when the same
callback is called the following time. I’ve tried sprinkling PgFlush() after
the PtSetResource(), but without success. Presumably, the operations are
queued in a buffer and are being processed in one go, meaning the effect of
the hiding-operation is immediately replaced by the showing-operation.
Is there some way I can force Photon to process the PtSetResource
hiding-operation immediately (i.e. long before the subsequent PtSetResource
is processed)?
Many thanks,
Neil
Neil Carter Psychology Department
IT Technician University of Wales Swansea
Wales, United Kingdom
http://psy.swansea.ac.uk/staff/Carter/
Oops! Made a silly mistake:
However, the second PtSetResource() is not working
Actually, it’s the first operation that’s not working – the message never
appears. It seems the message is shown and then hidden in immediate
sequence, so never makes an impression on the screen.
However, the question remains: Is there some way I can force Photon to
process PtSetResource immediately?
cheers,
Neil
Neil Carter Psychology Department
IT Technician University of Wales Swansea
Wales, United Kingdom
http://psy.swansea.ac.uk/staff/Carter/
The simplest solution is to stick a PtFlush() in the code before the
MsgSend(). This will do the trick.
On the other hand, if the delay/wait time of the MsgSend() is significant,
you should think of changing your code to make it multi-threaded to avoid
blocking on the server. While you application is blocked on MsgSend() it is
not going to redraw itself (for example on exposes – drag a window on top
of your blocked app, it won’t redraw before it is unblocked) – and this I
think you don’t want to happen.
-Misha.
“University of Wales Swansea: Psychology Technicians” <pstech@swansea.ac.uk>
wrote in message news:c68gc4$1dn$1@inn.qnx.com…
Hi all,
I’ve got a Photon client app that displays a message in a PtLabel using
PtSetResource(), then does a MsgSend() to a neutrino server. It then waits
for a reply from the server before hiding the message in the PtLabel
(PtSetResource() changes the label’s colour to the background colour). All
this is done in the same Activate callback attached to a PtButton). Here’s
a
rough sketch of the code:
PtSetResource( label, text_string, text ) /* set message /
PtSetResource( label, color, white ) / show message /
MsgSend( ) / wait for reply /
PtSetResource( label, color, black ) / hide message */
However, the second PtSetResource() is not working – the message remains
visible until it is overwritten by the next visible message when the same
callback is called the following time. I’ve tried sprinkling PgFlush()
after
the PtSetResource(), but without success. Presumably, the operations are
queued in a buffer and are being processed in one go, meaning the effect
of
the hiding-operation is immediately replaced by the showing-operation.
Is there some way I can force Photon to process the PtSetResource
hiding-operation immediately (i.e. long before the subsequent
PtSetResource
is processed)?
Many thanks,
Neil
Neil Carter Psychology Department
IT Technician University of Wales Swansea
Wales, United Kingdom
http://psy.swansea.ac.uk/staff/Carter/
“Misha Nefedov” <mnefedov@qnx.com> wrote in message
news:c68j8g$3kv$1@inn.qnx.com…
The simplest solution is to stick a PtFlush() in the code before the
MsgSend(). This will do the trick.
Excellent, it works fine now! I tried PgFlush(); I never noticed PtFlush().
Thanks!
Neil
Neil Carter Psychology Department
IT Technician University of Wales Swansea
Wales, United Kingdom
http://psy.swansea.ac.uk/staff/Carter/