1 /*
2 $Header: /cvsroot/lesstif/lesstif/test/Xm/filesb/test10.c,v 1.10 2002/05/01 15:39:21 amai Exp $
3 From: Karsten Jensen <kbwj@diku.dk>
4 To: lesstif@hungry.com
5 Subject: Re: FileSelection patch
6 Date: Mon, 29 Jun 1998 16:26:12 +0000
7
8 Rick Scott wrote:
9 >
10 > I have to disagree with the changes to FileSB.c. As you click the mouse
11 > in the various elements the default button does not change, hence the use
12 > of the dynamic default button. The default button remains the same only the
13 > result of pressing return changes. If the problem is anywhere I suspect it
14 > is in FileSB.c, since it is the only widget with this behaviour. Any of the
15 > other dialogs pressing return will activate the default button. Only
16 > FileSB does not always press the default button when return is pressed.
17
18
19
20 Rick, try this little program.
21
22 Karsten
23
24 */
25
26 #include <stdlib.h>
27 #include <stdio.h>
28
29 #include <Xm/Xm.h>
30 #include <Xm/FileSBP.h>
31
32 #include "../../common/Test.h"
33
34 #include "mkdirtree.h"
35
36
37 static char *FallBack[] = {
38 "*.geometrySlop: 0",
39 NULL
40 };
41
42 void
cb(Widget w,XtPointer a,XtPointer b)43 cb(Widget w, XtPointer a, XtPointer b) {
44 Widget fs = (Widget) a;
45 Widget default_button;
46
47 XtVaGetValues(fs, XmNdefaultButton, &default_button, NULL);
48 printf("%s The name of the default_button is now %s %s\n", XtName(w),
49 XrmQuarkToString(default_button->core.xrm_name), XtName(default_button));
50
51
52 }
53
54 int
main(int argc,char ** argv)55 main(int argc, char **argv)
56 {
57 XtAppContext app;
58 Widget toplevel, box, filter_text, text, list, dir_list;
59 make_tmp_dir_tree();
60
61 toplevel = XtVaAppInitialize(&app, "listTest", NULL, 0,
62 &argc, argv, FallBack, NULL);
63
64 box=XmCreateFileSelectionBox(toplevel,"Box",NULL,0);
65 set_path(box);
66 XtAddCallback(box, XmNfocusCallback, cb, box);
67 filter_text = XmFileSelectionBoxGetChild(box, XmDIALOG_FILTER_TEXT);
68 XtAddCallback(filter_text, XmNfocusCallback, cb, box);
69 text = XmFileSelectionBoxGetChild(box, XmDIALOG_TEXT);
70 XtAddCallback(text, XmNfocusCallback, cb, box);
71 dir_list = XmFileSelectionBoxGetChild(box, XmDIALOG_DIR_LIST);
72 XtAddCallback(dir_list, XmNbrowseSelectionCallback, cb, box);
73 list = XmFileSelectionBoxGetChild(box, XmDIALOG_LIST);
74 XtAddCallback(list, XmNbrowseSelectionCallback, cb, box);
75
76 XtAddCallback(box, XmNokCallback, cb, NULL);
77
78 XtManageChild(box);
79
80 XtRealizeWidget(toplevel);
81
82
83
84 {
85 #if XmVERSION > 1
86 static XtWidgetGeometry Expected[] = {
87 {CWWidth | CWHeight , 0, 0, 278, 372, 0,0,0, /* Box */},
88 {CWWidth | CWHeight | CWX | CWY, 183, 69, 83, 17, 0,0,0, /* Items */},
89 {CWWidth | CWHeight | CWX | CWY, 183, 86, 83, 154, 0,0,0, /* ItemsListSW */},
90 {CWWidth | CWHeight | CWX | CWY, 68, 0, 15, 135, 0,0,0, /* VertScrollBar */},
91 {CWWidth | CWHeight | CWX | CWY, 0, 139, 64, 15, 0,0,0, /* HorScrollBar */},
92 {CWWidth | CWHeight | CWX | CWY, 0, 0, 64, 135, 0,0,0, /* ItemsList */},
93 {CWWidth | CWHeight | CWX | CWY, 11, 250, 256, 17, 0,0,0, /* Selection */},
94 {CWWidth | CWHeight | CWX | CWY, 11, 267, 256, 31, 0,0,0, /* Text */},
95 {CWWidth | CWHeight | CWX | CWY, 0, 308, 278, 2, 0,0,0, /* Separator */},
96 {CWWidth | CWHeight | CWX | CWY, 11, 320, 64, 41, 0,0,0, /* OK */},
97 {CWWidth | CWHeight | CWX | CWY, 75, 320, 64, 41, 0,0,0, /* Apply */},
98 {CWWidth | CWHeight | CWX | CWY, 139, 320, 64, 41, 0,0,0, /* Cancel */},
99 {CWWidth | CWHeight | CWX | CWY, 203, 320, 64, 41, 0,0,0, /* Help */},
100 {CWWidth | CWHeight | CWX | CWY, 11, 11, 256, 17, 0,0,0, /* FilterLabel */},
101 {CWWidth | CWHeight | CWX | CWY, 11, 69, 162, 17, 0,0,0, /* Dir */},
102 {CWWidth | CWHeight | CWX | CWY, 11, 28, 256, 31, 0,0,0, /* FilterText */},
103 {CWWidth | CWHeight | CWX | CWY, 11, 86, 162, 154, 0,0,0, /* DirListSW */},
104 {CWWidth | CWHeight | CWX | CWY, 147, 0, 15, 135, 0,0,0, /* VertScrollBar */},
105 {CWWidth | CWHeight | CWX | CWY, 0, 139, 143, 15, 0,0,0, /* HorScrollBar */},
106 {CWWidth | CWHeight | CWX | CWY, 0, 0, 143, 135, 0,0,0, /* DirList */},
107 };
108 #else
109 static XtWidgetGeometry Expected[] = {
110 CWWidth | CWHeight , 56, 72, 286, 374, 0,0,0, /* Box */
111 CWWidth | CWHeight | CWX | CWY, 191, 69, 83, 17, 0,0,0, /* Items */
112 CWWidth | CWHeight | CWX | CWY, 191, 86, 83, 154, 0,0,0, /* ItemsListSW */
113 CWWidth | CWHeight | CWX | CWY, 68, 0, 15, 135, 0,0,0, /* VertScrollBar */
114 CWWidth | CWHeight | CWX | CWY, 0, 139, 64, 15, 0,0,0, /* HorScrollBar */
115 CWWidth | CWHeight | CWX | CWY, 0, 0, 64, 135, 0,0,0, /* ItemsList */
116 CWWidth | CWHeight | CWX | CWY, 11, 250, 264, 17, 0,0,0, /* Selection */
117 CWWidth | CWHeight | CWX | CWY, 11, 267, 264, 31, 0,0,0, /* Text */
118 CWWidth | CWHeight | CWX | CWY, 0, 308, 286, 2, 0,0,0, /* Separator */
119 CWWidth | CWHeight | CWX | CWY, 11, 320, 66, 43, 0,0,0, /* OK */
120 CWWidth | CWHeight | CWX | CWY, 77, 320, 66, 43, 0,0,0, /* Apply */
121 CWWidth | CWHeight | CWX | CWY, 143, 320, 66, 43, 0,0,0, /* Cancel */
122 CWWidth | CWHeight | CWX | CWY, 209, 320, 66, 43, 0,0,0, /* Help */
123 CWWidth | CWHeight | CWX | CWY, 11, 11, 264, 17, 0,0,0, /* FilterLabel */
124 CWWidth | CWHeight | CWX | CWY, 11, 69, 170, 17, 0,0,0, /* Dir */
125 CWWidth | CWHeight | CWX | CWY, 11, 28, 264, 31, 0,0,0, /* FilterText */
126 CWWidth | CWHeight | CWX | CWY, 11, 86, 170, 154, 0,0,0, /* DirListSW */
127 CWWidth | CWHeight | CWX | CWY, 155, 0, 15, 135, 0,0,0, /* VertScrollBar */
128 CWWidth | CWHeight | CWX | CWY, 0, 139, 151, 15, 0,0,0, /* HorScrollBar */
129 CWWidth | CWHeight | CWX | CWY, 0, 0, 151, 135, 0,0,0, /* DirList */
130 };
131 #endif
132 PrintDetails(toplevel,Expected);
133 };
134 LessTifTestMainLoop(toplevel);
135
136 exit(0);
137 }
138
139