[Search for users]
[Overall Top Noters]
[List of all Conferences]
[Download this site]
Title: | DECWINDOWS 26-JAN-89 to 29-NOV-90 |
Notice: | See 1639.0 for VMS V5.3 kit; 2043.0 for 5.4 IFT kit |
Moderator: | STAR::VATNE |
|
Created: | Mon Oct 30 1989 |
Last Modified: | Mon Dec 31 1990 |
Last Successful Update: | Fri Jun 06 1997 |
Number of topics: | 3726 |
Total number of notes: | 19516 |
3364.0. "Access violation using XtWindowToWidget" by DRIVEN::SANFORD () Wed Sep 19 1990 18:53
In the example below I am attempting to use a high level MESSAGE BOX
widget from within an application written using XLIB calls. Using the
"XtWindowToWidget" I had hoped to create a widget instance so that I
could call "DwtMessageBox". All I get is an access violation.
Below is a simple application showing the problem. This was built under
VMS V5.3 with DECW$XLIBSHR (ident DECW X21-IFT) and DECW$DWTLIBSHR
(ident DECWINDOWS V5.3).
I've tried almost everything, now I'm at the mercy of a response.
Thanks, -drew sanford
#include <DECW$INCLUDE:XLIB.H>
#include <DECW$INCLUDE:XUTIL.H>
#include <DECW$INCLUDE:XATOM.H>
#include <DECW$INCLUDE:INTRINSIC.H>
#include <decw$include:DwtAppl.h>
main ()
MAIN_PROGRAM
{
static Widget widget, mwidget;
static Display *display;
static Window window;
static XEvent event;
static int screen;
static DwtCompString label;
display = XOpenDisplay("");
screen = DefaultScreen(display);
window = XCreateSimpleWindow(display,
RootWindow(display, screen), 100, 50, 200, 150, 4,
BlackPixel(display, screen),
WhitePixel(display, screen) );
XSelectInput(display, window, ExposureMask);
XMapRaised(display, window);
XNextEvent(display, &event);
widget = XtWindowToWidget(display, window);
label = DwtLatin1String("Sample Message");
mwidget = DwtMessageBox (widget, "Message", 1, NULL,
NULL, DwtModal, label, NULL, NULL, NULL);
}
%SYSTEM-F-ACCVIO, access violation, reason mask=00, virtual address=00000000,
PC=0007851C, PSL=03C00004
%TRACE-F-TRACEBACK, symbolic stack dump follows
module name routine name line rel PC abs PC
0007851C 0007851C
TEST main 10869 000000E9 000004E9
T.R | Title | User | Personal Name | Date | Lines |
---|
3364.1 | Try widget=xtinitialize(...)
| SWTHOM::TISSERAND | Jean-Marc TISSERAND TSC FRANCE | Thu Sep 20 1990 04:45 | 17 |
| > In the example below I am attempting to use a high level MESSAGE BOX
> widget from within an application written using XLIB calls. Using the
> "XtWindowToWidget" I had hoped to create a widget instance so that I
> could call "DwtMessageBox". All I get is an access violation.
XtWindowToWidget returns a widget id for a given window.
If this window is a widget's window, you get the widget id.
Else you get NULL.
XtWindowToWidget doesn't not create a widget instance.
Giving a null widget parent to the message box results in accvio.
Hope this helps
Jean-Marc.
|
3364.2 | "Window To Widget" should create a widget instance | DRIVEN::SANFORD | | Thu Sep 20 1990 10:34 | 14 |
| The Intrinsic documentation for "Window To Widget" describes the
function to translate a window and display pointer into a widget
instance. I would assume they are referring to a low level Xlib
display/window.
The arguments (widget = XtWindowToWidget(display,window)):
display - The display on which the window is defined.
window - The window for which you want the widget.
Can I assume you CAN NOT mix Xlib with XUI calls? Seems unheard of
since they should only be different layers of protcol.
Confused... -drew
|
3364.3 | "Window To Widget" doesn't create a widget instance | LEOVAX::TREGGIARI | | Thu Sep 20 1990 12:27 | 11 |
|
.1 is correct; XtWindowToWidget does NOT create a widget instance. There is no way
to create a widget given a window. You create a widget which creates its own window.
The purpose of XtWindowToWidget is, given a window, tell me which widget it belongs to.
> Can I assume you CAN NOT mix Xlib with XUI calls? Seems unheard of
> since they should only be different layers of protcol.
Yes, you can, once you understand what they do and the limitations.
Leo
|
3364.4 | | CLTMAX::dick | Schoeller - Failed Xperiment | Mon Sep 24 1990 11:13 | 6 |
| Actually, Steve Klein built a pseudo-widget that would create widget structures
for an already existing window. I think it is in the VToolkit which can be
found in ELKTRA::DW_EXAMPLES. I am not sure that this will do what you want
but you might want to give it a try.
Dick
|