[comp.windows.x] XView help needed

denault@hale.ifa.hawaii.edu (Tony Denault) (03/20/90)

Help! I'm trying to write an XView program but can't seem to figure out
something. I am writing an program to control a camera. This program allows
the user to set parameters ( ie exposure time ). I defined a "Go" panel
which starts the camera. When the user selects "Go", I want to create a
window which displays a count down timer, camera status  and has a 
"Cancel" panel button to stop the camera. This seem simple but .. 

	- I don't want to allow the user to interact with the camera using the 
	  other panel buttons while its taking a picture. If I return control
	  to the notifier the user is free to interact with the program's 
	  other objects.

	- I like to print to a window the camera's status information but new
	  window can't appear and text written to a window is not updated 
	  until you return control to the notifer.

I'm new to event driven applications. Any Ideals?

Thanks,

Tony Denault
University of Hawaii
denault@hale.ifa.hawaii.edu

hvr@kimba.Sun.COM (Heather Rose) (03/21/90)

In article <7007@uhccux.uhcc.hawaii.edu> denault@hale.ifa.hawaii.edu (Tony Denault) writes:
>Help! I'm trying to write an XView program but can't seem to figure out
>something. I am writing an program to control a camera. This program allows
>the user to set parameters ( ie exposure time ). I defined a "Go" panel
>which starts the camera. When the user selects "Go", I want to create a
>window which displays a count down timer, camera status  and has a 
>"Cancel" panel button to stop the camera. This seem simple but .. 
>
>	- I don't want to allow the user to interact with the camera using the 
>	  other panel buttons while its taking a picture. If I return control
>	  to the notifier the user is free to interact with the program's 
>	  other objects.
>
>	- I like to print to a window the camera's status information but new
>	  window can't appear and text written to a window is not updated 
>	  until you return control to the notifier.
>
>I'm new to event driven applications. Any Ideals?

If you'd like the application to stay active, yet disable some functionality
there are a couple of methods to choose from.

To de-activate select buttons, use the PANEL_INACTIVE, TRUE attribute on the
selected panel items.  They will become grey'ed out to show that they are
not active.

To de-activate the entire panel, you can interpose on the panel and
temporarily not send certain events through, i.e. mouse and keyboard events.
The next release of XView has a function which does this for you via the
FRAME_BUSY interface.  Or, you get the input mask for the window, save it, 
then reset it, and restore it later.

To do a count down while remaining active, use the notify_set_itimer_func().
Set the timer value to be a second apart or whatever makes sense for your
camera. i.e. print out status every N seconds.

The trick is that you need to get out of the callback for your button so
things may continue working.  One easy way to do an infinite loop in XView
is to send an arbitrary event to an arbitrary Notify Client.  Or if you
want it timed, can get the same effect with notify_set_itimer_func() at
regular intervals.

All these functions should be explained in the O'Reilly XVPM, Vol. 7.  The
on line examples show how to use most of these functions.

__________________________________________________________________
Heather Rose
Window Systems Group                      internet:  hrose@sun.com
Sun Microsystems, Inc.                        uucp:  ...!sun!hrose