[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 |
2160.0. "Problem w/ Scroll Window & Translations" by SKUNK::PLESSAS () Mon Jan 29 1990 14:10
I am trying to add translations to a scroll window widget.
When I make the XtOverrideTranslations call I get an access
violation with a virtual address of 00000030. I get the same
result if I try to override the translations of the work window
associated to the scroll window. The same translation table
can be applied to the main window with no adverse effects.
An interesting sidenote: I get the same ACCVIO if I try to
XtInstallAllAccelerators on the scroll window widget or the work
window widget.
Following is a DCL com file containing a C module and a UIL
module as an example of this problem. The com file creates
the following files:
accvio.c, accvio.uil, accvio.obj, accvio.uid, accvio.exe
It runs accvio.exe to get the ACCVIO.
There is probably something basic that I don't understand here,
but any help would be greatly appreciated.
Thanx,
John
$! This COM file creates the following files:
$! accvio.c
$! accvio.uil
$! accvio.obj
$! accvio.uid
$! accvio.exe
$ create accvio.c
#include <decw$include/DwtAppl.h> /* DECwindows Toolkit */
#define ARRAYSIZE(x) (sizeof(x)/sizeof(x[0]))
static void Button1Down(
Widget w,
XEvent *event,
String *params,
Cardinal *num_params
);
static void CreateWidget(
Widget w,
int *objectIndex,
DwtAnyCallbackStruct *callbackdata);
static XtActionsRec myActions[] = {
{ "Button1Down", Button1Down },
};
static String myTranslations =
"<Btn1Down>: Button1Down()";
DRMHierarchy theDRMHierarchy; /* DRM database hierarchy and class variables */
DRMType *dummy_class;
Widget widgetArray[10];
int l_filenames_count = 1;
char *at_filenames [] = {
"accvio.uid"
};
static DRMRegisterArg reglist[] = {
{"CreateWidget",(caddr_t)CreateWidget},
};
Widget shellWidget;
Widget mainWindowWidget;
#define k_MainWindow 0
#define k_ScrollWindow 1
#define k_VScrollBar 2
#define k_HScrollBar 3
#define k_WorkWindow 4
main(
int argc,
char **argv)
{
XtTranslations newTrans;
memset(widgetArray, 0, sizeof(widgetArray));
DwtInitializeDRM(); /* Initialize DRM before */
/* initializing the X Toolkit. */
shellWidget =
XtInitialize(
"Test", /* Main window banner text. */
"Test", /* Root class name. */
NULL, /* No option list. */
0, /* Number of options. */
&argc, /* Address of argc */
argv); /* argv */
if ((DwtOpenHierarchy (l_filenames_count, /* number of files */
at_filenames, /* file name array */
NULL,
&theDRMHierarchy)) /* ptr to returned DRM id */
!= DRMSuccess)
printf("Error opening UID file\n");
/* Register the items DRM needs to bind for us. */
DwtRegisterDRMNames(reglist, ARRAYSIZE(reglist));
if ((DwtFetchWidget(theDRMHierarchy,
"MainWindow",
shellWidget,
&mainWindowWidget,
&dummy_class))
!= DRMSuccess)
printf("Error fetching widgets\n");
XtManageChild(mainWindowWidget);
XtRealizeWidget(shellWidget);
/* I can add these translations to my main window; no problem */
XtAddActions( myActions, ARRAYSIZE(myActions));
newTrans = XtParseTranslationTable( myTranslations );
XtOverrideTranslations ( mainWindowWidget, newTrans );
/* But when I try to add them to the scroll window, I get an accvio
for address 00000030 */
XtOverrideTranslations ( widgetArray[k_ScrollWindow], newTrans );
XtMainLoop();
}
static void Button1Down(
Widget w,
XEvent *event,
String *params,
Cardinal *num_params
)
{
printf("Button 1 down\n");
}
static void CreateWidget(
Widget w,
int *objectIndex,
DwtAnyCallbackStruct *callbackdata)
{
widgetArray[*objectIndex] = w;
}
$ create accvio.uil
module accvio
names = case_sensitive
character_set = iso_latin1
include file 'DwtAppl.uil';
procedure CreateWidget(integer);
value k_MainWindow : 0;
value k_ScrollWindow : 1;
value k_VScrollBar : 2;
value k_HScrollBar : 3;
value k_WorkWindow : 4;
object MainWindow : main_window {
arguments {
width = 100;
height = 100;
};
controls
{
scroll_window ScrollWindow;
};
};
object ScrollWindow : scroll_window {
arguments {
horizontal_scroll_bar = scroll_bar HScrollBar;
vertical_scroll_bar = scroll_bar VScrollBar;
work_window = window WorkWindow;
height = 100;
width = 100;
};
controls {
window WorkWindow;
scroll_bar HScrollBar;
scroll_bar VScrollBar;
};
callbacks {
create = procedure CreateWidget(k_ScrollWindow);
};
};
object VScrollBar : scroll_bar
{
arguments
{
orientation = DwtOrientationVertical;
};
callbacks
{
create = procedure CreateWidget(k_VScrollBar);
};
};
object HScrollBar : scroll_bar
{
arguments
{
orientation = DwtOrientationHorizontal;
};
callbacks
{
create = procedure CreateWidget(k_HScrollBar);
};
};
object WorkWindow : window
{
arguments
{
width = 50;
height = 50;
border_width = 0;
};
callbacks
{
create = procedure CreateWidget (k_WorkWindow);
};
};
end module;
$ cc/debug/noopt accvio.c
$ uil accvio.uil
$ link accvio,sys$input/opt
sys$library:decw$dwtlibshr/share
sys$library:decw$xlibshr/share
sys$share:vaxcrtl/share
$ run accvio
$ exit
T.R | Title | User | Personal Name | Date | Lines |
---|
2160.1 | override what??? | TOOLEY::B_WACKER | | Tue Jan 30 1990 13:11 | 4 |
| I works if you use augment instead of override.
What is the expected result of augment or override translations
depending upon whether or not there is already translations?
|
2160.2 | Fixed in R4 | LEOVAX::TREGGIARI | | Tue Feb 13 1990 08:57 | 6 |
| Our current Intrinsics do have problems with doing operations like
XtOverrideTranslations on a widget with no translations. These appear
to be fixed in the R4 Intrinsics which will ship on our platforms ~ 1 year
from now. I tried your program against the R4 Intrinsics and it works.
Leo
|