[PATCH] libXt: add simple example for XtName man page
walter harms
wharms at bfs.de
Sun Jan 23 08:12:36 PST 2011
[PATCH] add simple example for XtName
Signed-off-by: walter harms <wharms at bfs.de>
---
man/XtName.man | 33 +++++++++++++++++++++++++++++++++
1 files changed, 33 insertions(+), 0 deletions(-)
diff --git a/man/XtName.man b/man/XtName.man
index d271c9d..30036b3 100644
--- a/man/XtName.man
+++ b/man/XtName.man
@@ -1,3 +1,5 @@
+.\" $Xorg: XtName.man,v 1.3 2000/08/17 19:42:01 cpqbld Exp $
+.\"
.\" Copyright (c) 1993, 1994 X Consortium
.\"
.\" Permission is hereby granted, free of charge, to any person obtaining a
@@ -23,6 +25,8 @@
.\" dealing in this Software without prior written authorization from the
.\" X Consortium.
.\"
+.\" $XFree86: xc/doc/man/Xt/XtName.man,v 1.2 2001/01/27 18:20:28 dawes Exp $
+.\"
.ds tk X Toolkit
.ds xT X Toolkit Intrinsics \- C Language Interface
.ds xI Intrinsics
@@ -134,7 +138,36 @@ Specifies the widget.
.SH DESCRIPTION
.ZN XtName
returns the widget's name.
+
+.SH EXAMPLE
+
+The example demonstrate the use.
+.nf
+
+#include <stdio.h>
+#include <Intrinsic.h>
+#include <Xaw/Label.h>
+#include <Shell.h>
+/* gcc -I /usr/include/X11/ sample.c -lX11 -lXaw */
+int main(int argc, char *argv[])
+{
+ Widget top,label;
+ XtAppContext app;
+ top=XtOpenApplication(&app, "Xtdemo",
+ NULL,0,
+ &argc,argv,
+ NULL,
+ applicationShellWidgetClass,
+ NULL,0);
+ label=XtVaCreateManagedWidget
+ ("Hello_World", labelWidgetClass, top, NULL);
+ printf("Widget Name=%s\\n",XtName(label));
+ return 0;
+}
+
+.fi
.SH "SEE ALSO"
+.BR XtNameToWidget (3Xt)
.br
\fI\*(xT\fP
.br
--
1.6.0.2
More information about the xorg-devel
mailing list