Text Window freezes and expect some Mouse event - Xwindows
This is a discussion on Text Window freezes and expect some Mouse event - Xwindows ; Hi Friends
I have created a program to display text in text field in X window.
I have created a loop to display name of various elements.
For 1st element
XtSetValue()displays the text in text window. so after that
XtAppPending(appCon)
...
-
Text Window freezes and expect some Mouse event
Hi Friends
I have created a program to display text in text field in X window.
I have created a loop to display name of various elements.
For 1st element
XtSetValue()displays the text in text window. so after that
XtAppPending(appCon)
XtAppNextEvent (appCon, &ev);
XtDispatchEvent (&ev);
Work smoothly. It does not expect any event.
But for 2nd and more elements
XtSetValue() does not display text in text window.
Text is visible only after hitting the
XtAppPending(appCon) function
but after that
XtAppNextEvent (appCon, &ev);
expects some mouse event. But I want Window should disappear after
some time, until unless user does not do any action say press cancel or
help button.
I have used XtAppAddTimeOut function also.
void tlaguiWorkDialogText_c::EventLoop1()
{
static int timing_out = 0; /* Don't reenter! */
XtIntervalId timeout;
if (XtAppPending(appCon) && !timing_out)
{
XEvent ev;
timing_out = 1;
timeout = XtAppAddTimeOut (appCon, (unsigned
long)2000,(XtTimerCallbackProc)tlaguiWorkDialogTex t_c:EventLoop1,(XtPointer)
NULL);
do {
XtAppNextEvent (appCon, &ev);
XtDispatchEvent (&ev);
} while (ev.type != KeyPress && ev.type != KeyRelease && ev.type !=
ButtonPress && ev.type != ButtonRelease);
XtRemoveTimeOut(timeout);
timing_out = 0;
}
}
But still i am facing same problem.
Please suggest me, How can I resolve this issue.
Thanks & Regards
Vivek Garg
vivek.garg@wipro.com
-
Re: Text Window freezes and expect some Mouse event
"vivekgarg_79" wrote in message
news:1145436514.956320.23050@g10g2000cwb.googlegro ups.com...
> Hi Friends
>
> I have created a program to display text in text field in X window.
>
> I have created a loop to display name of various elements.
> For 1st element
>
> XtSetValue()displays the text in text window. so after that
>
> XtAppPending(appCon)
>
> XtAppNextEvent (appCon, &ev);
>
> XtDispatchEvent (&ev);
>
> Work smoothly. It does not expect any event.
>
> But for 2nd and more elements
> XtSetValue() does not display text in text window.
>
> Text is visible only after hitting the
>
> XtAppPending(appCon) function
> but after that
>
> XtAppNextEvent (appCon, &ev);
>
> expects some mouse event. But I want Window should disappear after
> some time, until unless user does not do any action say press cancel or
> help button.
>
> I have used XtAppAddTimeOut function also.
> void tlaguiWorkDialogText_c::EventLoop1()
> {
>
> static int timing_out = 0; /* Don't reenter! */
> XtIntervalId timeout;
>
> if (XtAppPending(appCon) && !timing_out)
> {
> XEvent ev;
> timing_out = 1;
> timeout = XtAppAddTimeOut (appCon, (unsigned
> long)2000,(XtTimerCallbackProc)tlaguiWorkDialogTex t_c:EventLoop1,(XtPointer)
> NULL);
>
> do {
> XtAppNextEvent (appCon, &ev);
> XtDispatchEvent (&ev);
> } while (ev.type != KeyPress && ev.type != KeyRelease && ev.type !=
> ButtonPress && ev.type != ButtonRelease);
>
> XtRemoveTimeOut(timeout);
> timing_out = 0;
> }
> }
>
> But still i am facing same problem.
> Please suggest me, How can I resolve this issue.
>
> Thanks & Regards
> Vivek Garg
> vivek.garg@wipro.com
>
Your application should not be calling XtAppNextEvent or XtDispatchEvent.
The normal way to do things is:
- Create your visible widgets
- Add the appropriate callbacks, event handlers, timers
- Realize your top level window
- Call XtAppMainLoop()
The call to XtAppMainLoop enters an infinite loop that never returns.
However, it does respond to all events, invoking the appropriate
callback functions, timer functions, and event handlers that you have
registered,
as well as those that all of your widgets have registered for themselves.
For example, when you call XtSetValues to set the text in a text widget,
the widget internally clears itself, causing an event to be added to the
event queue.
When XtAppMainLoop processes that event, it issues an expose event to the
text widget, which then re-draws itself.
--
Fred L. Kleinschmidt
Boeing Associate Technical Fellow
Technical Architect, Software Reuse Project