[comp.windows.x] Calling callbacks from a widget's set_values procedure

snl@edrc.cmu.edu (Sean Levy) (06/02/89)

Is there anything wrong with having a widget's SetValues() procedure
call some callbacks as a result of a state change? I have a widget that's
displaying an image of some sort at a (settable) location inside its window,
with a callback that gets called whenever the image moves. Generally, it
moves in response to mouse events, but it could also be moved by an explicit
call to XtSetValues() (to reset it to 0,0 perhaps).
--
--sean levy
  research programmer, engineering design research center, carnegie mellon
  internet: snl@edrc.cmu.edu
    bitnet: snl@edrc.cmu.edu%CMCCVMA
      uucp: ...!harvard!cs.cmu.edu!snl
     2wire: 412 268 2257
      dirt: EDRC / CMU / DH A219 / Pittsburgh PA 15213
-- 

swick@ATHENA.MIT.EDU (Ralph R. Swick) (06/05/89)

> Is there anything wrong with having a widget's SetValues() procedure
> call some callbacks as a result of a state change? 

Nope, not at all.  You will have to be careful, however, to make sure
the widget hierarchy is in a consistent state when you execute the
callbacks, or carefully document the environment that the callback
will see.  For example, if you follow the recommended geometry
management scheme the widget's geometry fields are not accurate
until after all the set_values (and the final set_values_almost)
methods have completed.