A Conversation for The H2G2 Programmers' Corner

A little hand with c++

Post 1

Acid Override - The Forum A1146917

Hi all, first time posting so I don't know how to go about it. I guess I'll just lament my problem and see if anyone helps :P If they do I'll subscribe and try to help out anyone with a problem that I can solve, but since I only know useless programming langauges like pop-11 I guess that won't be too many people.

Anyway, I'm trying to update a c++ program which uses an XmPushButton widget. All I'm trying to do is write a line of code which has the same effect as that button being pushed. For some reason I don't seem to be able to do it and I can't find any docunmentation on how the class works. As far as I can tell there is a loop which iterates indefinately over these lines:

XEvent event;
XtAppNextEvent(context,&event);
XtDispatchEvent(&event);

I think the first line declares a instance of a structure (XEvent), the second waits for an event and adds it to a queue and the third resolved the event, so theoretically what I need is a line like XtDispatchEvent(pushbuttonwidgetpushed) but I can't find a definition of the event structure so I don't know what argument to pass it.

Can anyone help?


A little hand with c++

Post 2

Jerms - a Brief flicker and then gone again.

It seems that the AppNextEvent object fills in values in the new event object you pass to it. If you can find out how that works given a context then perhaps you can create the contect artificially, call it, and have the event you need returned by it, ready for use by the DispatchEvent object?

so try:
Context my_context = new Context();
my_context.blah = "button has been pushed"; // fill in whatever values you need.

XEvent event;
XtAppNextEvent(my_context,&event);
XtDispatchEvent(&event);

Hope this helps. If all else fails don't underestimate the power of google, just remember to give it very specific keywords if you want to find specific info.

smiley - cheers


Key: Complain about this post

Write an Entry

"The Hitchhiker's Guide to the Galaxy is a wholly remarkable book. It has been compiled and recompiled many times and under many different editorships. It contains contributions from countless numbers of travellers and researchers."

Write an entry
Read more