[comp.windows.x] Multiple

ramabads@cs.rpi.edu (Shiva ) (03/22/91)

I am building an X application using X11R4, with Athena Widgets on a 
Sun SPARC, SUNOS 4.1.1.

The Application has a large canvas which displays certain objects, and a series 
of buttons and menus around it, which act on the objects displayed. I can pick, 
and move the objects around on the screen, or call upon CAllbacks attached to 
to the buttons or menus items.

Most of the buttons, and menu items, are toggle in nature, i.e. they switch on 
or off.   and are easy to implement.

Some however, require  additional input, in the form of a selection of an object
from the canvas. I am using Button2 to move the objects, and Button1 to select
the objects, so there is no clash there. 

In the cases where the additional input buttons are activated, I need  to 
disable the actions of all the other buttons, (and the movement capability)
till a selection has taken place.  

i.e.     Say once I have clicked on button3 which is FillObject, I have to go
into the canvas, and select an object to fill. Till this is done, I should not 
be able to move any objects, or toggle any of their attributes, or activate any
other object selection procedures.

This essentially involves, ignoring all events, till a specific event is 
recieved ( in this case, it would be a Button1PressEvent on my Canvas Widget. )

AND FINALLY THE QUESTION :

	IS there an elegant way of doing this. I have several such buttons, 
and keeping global flags, and checking in every callback is not my idea of 
fun.


Thanks,

-shiv
-=-
Shivkumar Ramabadran          (shiva)             ramabads@turing.cs.rpi.edu

"I once wrote a Lisp program.  It wrote back to me."
-=-

ramabads@cs.rpi.edu (Shiva ) (03/22/91)

In article <R1==6%{@rpi.edu>, I write:

[Tons of Explanations deleted]

|> This essentially involves, ignoring all events, till a specific event is 
|> recieved ( in this case, it would be a Button1PressEvent on my Canvas Widget. )
|> 
|> AND FINALLY THE QUESTION :
|> 
|> 	IS there an elegant way of doing this. I have several such buttons, 
|> and keeping global flags, and checking in every callback is not my idea of 
|> fun.
|> 
|> 


I RTFM'd for a while, and found the Xtoolkit functions 

	XtAddGrab()   &  XtRemoveGrab() to do exactly what I needed.  I should
spend more time RTM'ing before I post.

	This posting is to pre-empt numerous postings with the solution.


Thanks, again,

-shiva
-=-
Shivkumar Ramabadran          (shiva)             ramabads@turing.cs.rpi.edu

"I once wrote a Lisp program.  It wrote back to me."
-=-