sundar@WHEATIES.AI.MIT.EDU (Sundar Narasimhan) (07/18/88)
a.
I have an application that has a rather complicated function bound to
a command button's callback. Since this function takes a long time,
ideally I would like to be able to provide feedback to the user at
intermediate points like:
command_init(server)
char *server;
{
update_status("Contacting remote host ...");
contact_host(server);
update_status("Contacting remote host ... Done");
group_request();
update_status("Checking validity ...");
group_check();
update_status("Checking validity ...Done");
/* etc, etc ...*/
}
update_status(), could for example change the text string associated
with a static text widget. Now, the way the toolkit functions are
set up, one would have to write one's own XtMainLoop()/select() to do this, am
I right? (or is there some other way of intercepting this loop)?
Currently, I get to seeing only the last of the update status
messages.. XFlush() doesn't help.
Ah.. if only I had something like (tv:noting-progress..
b. Regarding translation tables: How does one invoke a function normally
in a translation table of a widget from within a program? For example,
I would like to scroll a text window's display one page up from
within my program. There must be a simple way of doing this, which I
am obviously too dense to decipher..
-Sundar
ps. this is just a request: nowadays I dread sending messages to xpert
because of the 20 or so bounceback messages that get generated for
every msg I send out. I know this is kind of a pain, but people, could
everyone garbage collect their mailing lists at least once in a while ...
Thanks.
swick@ATHENA.MIT.EDU (Ralph R. Swick) (07/18/88)
Date: Sun, 17 Jul 88 19:52:12 EDT From: sundar@wheaties.ai.mit.edu (Sundar Narasimhan) a. I have an application that has a rather complicated function bound to a command button's callback. Since this function takes a long time, ideally I would like to be able to provide feedback to the user at intermediate points ... Now, the way the toolkit functions are set up, one would have to write one's own XtMainLoop()/select() to do this, am I right? (or is there some other way of intercepting this loop)? In general yes, you will need to include your own XtNextEvent/ XtDispatchEvent code within your compute-bound function if the application is single threaded. For many things, you can get away with merely processing Exposure events using XCheckIfEvent/XtDispatchEvent. Currently, I get to seeing only the last of the update status messages.. XFlush() doesn't help. I don't understand why. If you're not reading events, XFlush is the correct way to make sure new requests are dequeued from the client. b. Regarding translation tables: How does one invoke a function normally in a translation table of a widget from within a program? For example, I would like to scroll a text window's display one page up from within my program. There is at present no way to invoke a widget's Action routines without an input event. Widgets are expected to export public procedures to do this (which will frequently be wrappers around their Actions). I know this is kind of a pain, but people, could everyone garbage collect their mailing lists at least once in a while ... Thanks. Amen.
jbs@fenchurch.MIT.EDU (Jeff Siegal) (07/19/88)
In article <8807172352.AA17403@special-k.ai.mit.edu> sundar@WHEATIES.AI.MIT.EDU (Sundar Narasimhan) writes: >[...] >I have an application that has a rather complicated function bound to >a command button's callback. Since this function takes a long time, >ideally I would like to be able to provide feedback to the user at >intermediate points [...] Rather than execute the complicated function directly from the callback, you could queue events to display the status messages and do the processing: queue_event(display_message1) queue_event(processing_part_1) queue_event(display_message2) queue_event(processing_part_2) . . . After queueing all the events, the command button callback would return, and the events would be processed. I don't see anything directly intended to be used as queue_event() above, but perhaps you could use the timeout mechanism (maybe with a zero or small time interval). Jeff Siegal