[Date Prev] [Date Next] [Thread Prev] [Thread Next] Date Index Thread Index Search archive:
Date:Mon Jun 26 23:57:00 1993 
Subject:controlling Xved from callbacks 
From:"A.Sloman" 
Volume-ID:930627.01 

I thought others might be interested in the solution I found to a
problem.

I've been trying to design a simple user-tailorable alternative
to the Poplog UI, including primarily menu driven commands to make
VED work whether in an xterm window or in Xved.

Dealing with ordinary VED was OK, but with Xved I struggled for ages
trying to get procedures like vedscreendown, vedscreenup, vedrefresh,
etc. to work when invoked from a separate menu, and eventually
discovered the solution by accident, as it's not documented in
HELP XVED, TEACH XVED or REF XVED

In ordinary Ved, a callback can (in most cases) invoke a VED procedure
directly. However, in Xved this doesn't work: and what you have to do is
put the procedure into the input stream using vedinput, and then call

            XptSetXtWakeup();

whose definition (in REF * XT_EVENT) states

        This  procedure  is  intended  to  be  called  within   external
        callbacks. It causes control to  return to the POPLOG  top-level
        at the next convenient  point (ie, after  all the callbacks  etc
        associated with the  event currently being  processed have  been
        run). -XptSetXtWakeup-  is used  because deferring  a  procedure
        call using -XptDeferApply- is not  always enough, since we  stay
        in the  Toolkit code  until we  see an  interrupt or  input. ...

My life would have been simplified if built into the definition of
vedinput had been the following:

    if vedusewindows == "x" then
        XptSetXtWakeup();
    endif;

Perhaps it should be changed ?

Anyhow it turns out that you can define a general procedure something
like this

define ved_do_action( P);
    lvars P;
    if vedusewindows == "x" then
        vedinput(P);
        XptSetXtWakeup();
    else
        P();
        vedcheck();
        vedsetcursor();
    endif
enddefine;

and use it to run vedprocedures from callbacks.

Maybe something like this should be a standard library procedure
for Ved extensions and Ved-based applications?
Aaron