[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 |
1980.0. "width/height increment problem in toolkit" by CSC32::B_BRADACH () Fri Dec 29 1989 12:01
I have a customer who is setting the width and height increment
attributes for the top level shell. Everything works just fine, the
window comes up, press the resize button in the name stripe and the
increment value is used as advertised. However, he has a callback
routine on a push button which resizes the main window by using
setvalues/setarg combination. This also works, press the push button,
the window size changes. Now for the problem --- once this window is
resized the increment values disappear and revert to the defaults.
I have tried explicitly resetting the increment values in the resize
routine to no avail.
Does anyone have any ideas, is this a bug???
bernie
csc/cs
code follows:
cut here
==========================================================================
#include <stdio.h>
#ifdef VMS
#include <decw$include/DwtAppl.h> /* DECwindows Toolkit */
#else
#include <X11/DwtAppl.h> /* DECwindows Toolkit */
#endif
static DRMHierarchy s_DRMHierarchy; /* DRM database hierarch id */
static char *vec[]={"helloworld.uid"};
/* DRM database file list */
static DRMCode class ;
static void helloworld_button_activate();
static DRMCount regnum = 1 ;
static DRMRegisterArg regvec[] = {
{"helloworld_button_activate",(caddr_t)helloworld_button_activate}
};
#define MAX_WINDOW_WIDTH 960
#define MAX_WINDOW_HEIGHT 800
#define MIN_WINDOW_WIDTH 480
#define MIN_WINDOW_HEIGHT 300
#define WINDOW_WIDTH_INC 160
#define WINDOW_HEIGHT_INC 100
Widget toplevel, helloworldmain;
setup_shell()
{
Arg arglist[20];
XtSetArg(arglist[0], XtNwidthInc, WINDOW_WIDTH_INC);
XtSetArg(arglist[1], XtNheightInc, WINDOW_HEIGHT_INC);
XtSetArg(arglist[2], XtNminWidth, MIN_WINDOW_WIDTH);
XtSetArg(arglist[3], XtNminHeight, MIN_WINDOW_HEIGHT + 20);
XtSetArg(arglist[4], XtNmaxWidth, MAX_WINDOW_WIDTH);
XtSetArg(arglist[5], XtNmaxHeight, MAX_WINDOW_HEIGHT + 20);
XtSetValues (toplevel, arglist, 6);
}
resize_window (width, height )
int width;
int height;
{
Arg arglist[20];
fprintf (stderr, "Resizing window to %d, %d\r\n", width, height);
/*
* setting the increment explicitly here does not help
*
*/
XtSetArg(arglist[0], XtNwidthInc, WINDOW_WIDTH_INC);
XtSetArg(arglist[1], XtNheightInc, WINDOW_HEIGHT_INC);
XtSetArg (arglist[2], DwtNwidth, width);
XtSetArg (arglist[3], DwtNheight, height);
XtSetValues (helloworldmain, arglist, 4);
}
/*
* Main program
*/
int main(argc, argv)
unsigned int argc;
char **argv;
{
/*
* Declare the variables to contain the two widget ids
*/
Arg arglist[1] ;
/*
* Initialize the DRM
*/
DwtInitializeDRM ();
/*
* Initialize the toolkit. This call returns the id of the "toplevel"
* widget. The applications "main" widget must be the only child
* of this widget.
*/
toplevel = XtInitialize(
"Hi", /* application name */
"helloworldclass", /* application class */
NULL, 0, /* options */
&argc, argv); /* command line parameters */
XtSetArg (arglist[0], XtNallowShellResize, TRUE) ;
XtSetValues (toplevel, arglist, 1) ;
/*
* Define the DRM hierarchy (only 1 file)
*/
if (DwtOpenHierarchy (1, /* number of files */
vec, /* files */
NULL, /* os_ext_list (null) */
&s_DRMHierarchy) /* ptr to returned id */
!= DRMSuccess) {
printf ("can't open hierarchy");
}
/*
* Register our callback routines so that the resource manager can
* resolve them at widget-creation time.
*/
DwtRegisterDRMNames (regvec, regnum) ;
/*
* Call DRM to fetch and create the pushbutton and its container
*/
if (DwtFetchWidget (s_DRMHierarchy,
"helloworld_main",
toplevel,
&helloworldmain,
&class)
!= DRMSuccess)
printf("can't fetch interface");
/*
* Make the toplevel widget "manage" the main window (or whatever the
* the uil defines as the topmost widget). This will
* cause it to be "realized" when the toplevel widget is "realized"
*/
XtManageChild(helloworldmain);
/*
* Realize the toplevel widget. This will cause the entire "managed"
* widget hierarchy to be displayed
*/
XtRealizeWidget(toplevel);
setup_shell();
/*
* Loop and process events
*/
XtMainLoop();
/* UNREACHABLE */
return (0);
}
static void helloworld_button_activate( widget, tag, callback_data )
Widget widget;
char *tag;
DwtAnyCallbackStruct *callback_data;
{
Arg arglist[2];
static int call_count = 0;
call_count += 1 ;
switch ( call_count )
{
case 1:
XtSetArg( arglist[0], DwtNlabel,
DwtLatin1String("Goodbye\nWorld!") );
XtSetArg( arglist[1], DwtNx, 11 );
XtSetValues( widget, arglist, 2 );
resize_window(MAX_WINDOW_WIDTH, MAX_WINDOW_HEIGHT);
break ;
case 2:
resize_window(500,350);
break ;
case 3:
exit(1);
break ;
}
}
cut here for uil file
========================================================================
!++
! COPYRIGHT (c) 1988 BY
! DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASSACHUSETTS.
! ALL RIGHTS RESERVED.
!
! THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED AND COPIED
! ONLY IN ACCORDANCE OF THE TERMS OF SUCH LICENSE AND WITH THE
! INCLUSION OF THE ABOVE COPYRIGHT NOTICE. THIS SOFTWARE OR ANY OTHER
! COPIES THEREOF MAY NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY
! OTHER PERSON. NO TITLE TO AND OWNERSHIP OF THE SOFTWARE IS HEREBY
! TRANSFERRED.
!
! THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT NOTICE
! AND SHOULD NOT BE CONSTRUED AS A COMMITMENT BY DIGITAL EQUIPMENT
! CORPORATION.
!
! DIGITAL ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY OF ITS
! SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY DIGITAL.
!--
module helloworld
version = 'v1.0'
names = case_sensitive
procedure
helloworld_button_activate();
object
helloworld_main : dialog_box {
controls {
label helloworld_label;
push_button helloworld_button;
};
};
object
helloworld_button : push_button {
arguments {
x = 15;
y = 40;
label_label = compound_string('Hello world');
};
callbacks {
activate = procedure helloworld_button_activate();
};
};
object
helloworld_label : label {
arguments {
label_label =
compound_string('Press button once');
};
};
end module;
T.R | Title | User | Personal Name | Date | Lines |
---|
1980.1 | response from decwtoolkit | CSC32::B_BRADACH | | Wed Jan 10 1990 18:09 | 26 |
| I had cross-posted this problem in decwtoolkit conference and I got the
following response:
<<< CLT::DISK$CLT_LIBRARY2:[NOTES$LIBRARY]DECWTOOLKIT.NOTE;1 >>>
-< DECwindows Toolkit >-
================================================================================
Note 323.1 width/height increment "disappears" 1 of 2
R2ME2::BENNISON "Victor L. Bennison DTN 381-2156 ZK2" 4 lines 3-JAN-1990 11:10
--------------------------------------------------------------------------------
This sounds like the result of a known problem between the shell
intrinsics code and the window manager. Have you tried using
XSetSizeHints instead of SetValues?
- Vick
================================================================================
Note 323.2 width/height increment "disappears" 2 of 2
CSC32::B_BRADACH 7 lines 10-JAN-1990 16:17
-< thanks - XSetNormalHints did the trick >-
--------------------------------------------------------------------------------
Thanks for the suggestion - I ended up using XSetNormalHints and it
works for what my customer wants to do. The width and height increments
now remain in effect.
bernie
csc/cs
|