Article View: fj.windows.x
Article #186Re: Q: Event
From: Takanori Nagae
Date: Fri, 16 Oct 1992 11:10
Date: Fri, 16 Oct 1992 11:10
95 lines
3249 bytes
3249 bytes
In article <ADACHI.92Oct15200647@ailabc.d.dendai.ac.jp>
adachi@ailabc.d.dendai.ac.jp (adachi) writes:
> $@Nc$($P!"O"B3$9$k%S%C%H%^%C%W$r(J$@%"%K%a!<%7%g%s$9$k>l9g!"(JXlib $@$G$N(Jmain
>loop $@$O$I$N$h$&$J46$8$K$J$k$N$G$7$g$&$+!)(J
Xlib$@!*!)(J
$@;H$o$J$$$[(J$@$&$,$$$$$G$7$g$&!%(J
Xt Intrinsics$@$r;H$&$J$i!$(JTimerCallbackProc$@$H$$$&$N$,;H$($^$9!%(J
$@$?$H$($P!$(J
-----
#include <X11/Intrinsic.h>
#include <X11/StringDefs.h>
#include <X11/Xaw/Label.h>
XtAppContext app_con;
Display *disp;
Widget top, label;
void timer_proc(count)
int count;
{
char str[10];
if(0 == count % 10) XBell(disp, 0);
sprintf(str, "%d", count);
XtVaSetValues(label, XtNlabel, str, NULL);
XtAppAddTimeOut(app_con, 1000, timer_proc, count + 1);
}
main(argc, argv)
int argc;
char **argv;
{
static String fallback[] ={"*label.label: timer test", NULL};
top = XtVaAppInitialize(&app_con, "TimerTest",
NULL, 0, &argc, argv, fallback, NULL);
label = XtVaCreateManagedWidget("label",
labelWidgetClass, top, NULL);
disp = XtDisplay(top);
XtRealizeWidget(top);
timer_proc(0);
XtAppMainLoop(app_con);
}
---
XtAppAddTimeOut$@$K$h$C$F(Japplication context$@$K#n%_%jIC8e$K<B9T$9$Y$-<jB3(J
$@$-$rEPO?$7$^$9!%H?I|$9$k$K$O!$(JTimerCallbackProc$@$NCf$G(JXtAppAddTimeOut$@$r(J
$@8F$S=P$;$P$h$$$o$1$G$9$M!%(J
$@%"%K%a!<%7%g%s$K$O%"%W%j%1!<%7%g%s$,$R$^$J$H$-$K<B9T$5$l$k(JWorkProc$@$NJ}(J
$@$,E,$7$F$$$k$H;W$$$^$9!%Nc$($P(J $@!$(J
---
#include <X11/Intrinsic.h>
#include <X11/StringDefs.h>
#include <X11/Xaw/Label.h>
Widget top, label;
Display *disp;
void work_proc()
{
char str[10];
static unsigned long count = 0;
if(0 ==(++count)% 1000) XBell(disp, 0);
sprintf(str, "%d", count);
XtVaSetValues(label, XtNlabel, str, NULL);
}
main(argc, argv)
int argc;
char **argv;
{
static String fallback[] ={"*label.label: workproc test", NULL};
XtAppContext app_con;
top = XtVaAppInitialize(&app_con, "WorkTest",
NULL, 0, &argc, argv, fallback, NULL);
label = XtVaCreateManagedWidget("label",
labelWidgetClass, top, NULL);
disp = XtDisplay(top);
XtRealizeWidget(top);
XtAppAddWorkProc(app_con, work_proc, NULL);
XtAppMainLoop(app_con);
}
---
O'Reilly$@$N(JVolume 4$@$N(J
8.4 TimeOuts
8.5 Work Procedures
$@$K=q$$$F$"$j$^$9!%(J
_ __ __
][ ][ ]$@1J9>(J $@9'5,(J nagae@an.isl.titech.ac.jp
[__][__][_ $@El9)Bg(J $@A|>pJs9)3X8&5f;\@_(J $@0B5o1!8&(J
Technical Details
Message-ID:
<NAGAE.92Oct16201051@cosmos.an.isl.titech.ac.jp>Path:
arc1-ca.pugleaf.net!sparky!uunet!ccut!wnoc-tyo-news!cs.titech!titccy.cc.titech!sys.titech.ac.jp!pi.titech!isl.titech!islsun!nagaeReferences:
<ADACHI.92Oct15200647@ailabc.d.dendai.ac.jp>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!ccut!wnoc-tyo-news!cs.titech!titccy.cc.titech!sys.titech.ac.jp!pi.titech!isl.titech!islsun!nagae From: nagae@an.isl.titech.ac.jp (Takanori Nagae) Newsgroups: fj.windows.x Subject: Re: Q: Event Message-ID: <NAGAE.92Oct16201051@cosmos.an.isl.titech.ac.jp> Date: 16 Oct 92 11:10:51 GMT References: <ADACHI.92Oct15200647@ailabc.d.dendai.ac.jp> Sender: news@isl.titech.ac.jp Reply-To: nagae@an.isl.titech.ac.jp Distribution: fj Organization: Imaging Science and Engineering Lab., Tokyo Inst. of Tech., Japan Lines: 95 Nntp-Posting-Host: cosmos In-reply-to: adachi@ailabc.d.dendai.ac.jp's message of 15 Oct 92 11:06:47 GMT