hari@matrix.UUCP (T hariharan) (04/10/91)
Read further only if you have "guide" installed.
Otherwise you can ignore this.
Store the rest of this message in a file and put it through "sh", i.e.:
mkdir /tmp/xvbug
cd /tmp/xvbug
# save the rest of this message in /tmp/xvbug/xvbug.shar
sh xvbug.shar
Then read README for further info.
# ---------------- Save from next line ------------------
echo Makefile 1>&2
cat > Makefile <<'End of Makefile'
# This file was generated by `gxv' from `fname.G'.
# Parameters.
PROGRAM = fname
SOURCES.c = fname_main.c
SOURCES.h =
SOURCES.G = fname.G
STUBS.G = fname.G
# Derived parameters.
SOURCES = \
$(SOURCES.G) \
$(SOURCES.h) \
$(SOURCES.l) \
$(SOURCES.y) \
$(SOURCES.c)
TARGETS.c = \
$(SOURCES.G:%.G=%_ui.c)
# $(STUBS.G:%.G=%_stubs.c)
TARGETS.h = \
$(SOURCES.G:%.G=%_ui.h) \
$(SOURCES.l:%.l=%.h) \
$(SOURCES.y:%.y=%.h)
TARGETS.other = \
$(SOURCES.G:%.G=%.info)
TARGETS = \
$(TARGETS.other) \
$(TARGETS.h) \
$(TARGETS.c)
OBJECTS = \
$(SOURCES.c:%.c=%.o) \
$(TARGETS.c:%.c=%.o)
# Compiler flags.
CFLAGS += -g
CPPFLAGS += -I$(GUIDEHOME)/include -I$(OPENWINHOME)/include -DMAIN
LDFLAGS += -L$(GUIDEHOME)/lib -L$(OPENWINHOME)/lib
LDLIBS += -lguide -lguidexv -lxview -lolgx -lX
# Standard targets.
all: $(TARGETS.other) $(PROGRAM)
objects: $(SOURCES.c) $(TARGETS.c) $(TARGETS.h) $(OBJECTS)
sources: $(SOURCES)
targets: $(SOURCES) $(TARGETS)
$(PROGRAM): $(SOURCES.c) $(TARGETS.c) $(TARGETS.h) $(OBJECTS)
$(LINK.c) -o $(PROGRAM) $(OBJECTS) $(LDLIBS)
# Targets to be used by a certain CASE tool.
stest: $(SOURCES.c) $(TARGETS.c) $(TARGETS.h) $(OBJECTS)
#load $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH) \
-o $(PROGRAM) $(SOURCES.c) $(TARGETS.c) $(LDLIBS)
%_ui.c + %_ui.h + %_stubs.c + %.info: %.G
$(GUIDEHOME)/bin/gxv $*
clean:
$(RM) $(TARGETS) $(OBJECTS) $(SOURCES.G:%.G=%_stubs.c) core
End of Makefile
echo README 1>&2
cat > README <<'End of README'
1. run "make" to build "fname"
NOTE: you need "guide" and the XView libraries for this.
2. run "fname". Type anything into the text field and hit <Return>.
You'll find that the alert frame comes up and disappears immediately.
Now, hit <LineFeed> or <Tab> instead of <Return>. The alert frame
stays up until you hit <Return> or click the left mouse button.
NOTE: Sometimes, the alert frame stays up even if you hit <Return>
This does seem to be a XView bug. However, "guide" handles this properly.
If you try to Load a non-existent file (hitting <Return> after typing the
filename), the alert frame does stay up. Looks like I'm missing something
here.
Please email your responses. I'll summarize.
Thanks,
Hari
uunet!matrix!hari
Matrix Computer Systems
1 Tara Boulevard
Nashua NH 03062
(603) 888 7790
End of README
echo fname.G 1>&2
cat > fname.G <<'End of fname.G'
;GIL-2
(
(
:type :base-window
:name window1
:owner nil
:width 400
:height 79
:background-color ""
:foreground-color ""
:label "Base Window"
:label-type :string
:mapped t
:show-footer t
:resizable t
:icon-file ""
:icon-mask-file ""
:event-handler nil
:events ()
:user-data ()
)
(
:type :control-area
:name controls1
:owner window1
:help ""
:x 0
:y 0
:width 400
:height 79
:background-color ""
:foreground-color ""
:show-border nil
:menu nil
:event-handler nil
:events ()
:user-data ()
)
(
:type :text-field
:name textfield
:owner controls1
:help ""
:x 80
:y 32
:width 235
:height 15
:foreground-color ""
:text-type :alphanumeric
:label "Filename:"
:label-type :string
:value-x 155
:value-y 32
:layout-type :horizontal
:value-length 20
:stored-length 80
:read-only nil
:notify-handler load_file_proc
:event-handler nil
:events ()
:user-data ()
)
)
End of fname.G
echo fname_main.c 1>&2
cat > fname_main.c <<'End of fname_main.c'
/*
* fname_stubs.c - Notify and event callback function stubs.
* This file was generated by `gxv' from `fname.G'.
* DO NOT EDIT BY HAND.
*/
#include <stdio.h>
#include <sys/param.h>
#include <sys/types.h>
#include <xview/xview.h>
#include <xview/panel.h>
#include <xview/textsw.h>
#include <xview/xv_xrect.h>
#include <xview/notice.h>
#include <gdd.h>
#include "fname_ui.h"
#ifdef MAIN
/*
* Instance XV_KEY_DATA key. An instance is a set of related
* user interface objects. A pointer to an object's instance
* is stored under this key in every object. This must be a
* global variable.
*/
Attr_attribute INSTANCE;
void
main(argc, argv)
int argc;
char **argv;
{
fname_window1_objects *fname_window1;
/*
* Initialize XView.
*/
xv_init(XV_INIT_ARGC_PTR_ARGV, &argc, argv, 0);
INSTANCE = xv_unique_key();
/*
* Initialize user interface components.
*/
fname_window1 = fname_window1_objects_initialize(NULL, NULL);
/*
* Turn control over to XView.
*/
xv_main_loop(fname_window1->window1);
exit(0);
}
#endif
Panel_setting
load_file_proc(item, event)
Panel_item item;
Event *event;
{
fname_window1_objects *ip = (fname_window1_objects *) xv_get(item, XV_KEY_DATA, INSTANCE);
warn(ip->window1, event, "File does not exist",
(char *) xv_get(ip->textfield, PANEL_VALUE), NULL);
return (PANEL_NONE); /* ignore input character */
}
warn(frame, event, msg1, msg2)
Event *event;
Xv_opaque frame;
char *msg1, *msg2;
{
#define MAXLINES 2 /* allow 2 lines max */
int status, nmsgs;
int xpos, ypos;
char *errmsg; /* 1st line of err msg */
char *msg_array[MAXLINES+1];
register char **cpp;
Rect rect;
msg_array[0] = msg1;
msg_array[1] = msg2;
msg_array[2] = NULL;
frame_get_rect(frame, &rect);
xpos = rect.r_width / 2;
ypos = rect.r_height / 2;
(void) notice_prompt(frame,
event,
NOTICE_FOCUS_XY, xpos, ypos,
NOTICE_MESSAGE_STRINGS_ARRAY_PTR, msg_array,
NOTICE_BUTTON_YES, "Continue",
0);
}
End of fname_main.c