[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 |
963.0. "Question about XUI/background_pixmap attribute." by TKTV20::HIME () Fri Jun 16 1989 07:57
I have a question about XUI Widget Attribute "BackgroundPixMap".
I create some widgets as follow.
+-main(scrollwindow)------------+--+
| background_pixmap = pixmapID | |
| | |
| | |
| |vertical_scroll_bar
| +------------+ work_window | (scroll_bar)
| |A | (dialog_box) | |
| | | background_pixmap = ParentRelative
| | | | |
| |temp1 | | |
| |(dialog_box)| | |
| +------------+ | |
| background_pixmap | |
| = Parent Relative | |
| | |
+-------------------------------+--+
1. Click on the down arrow of scroll_bar to scroll up the work_window.
2. A Value_changed procedure of scroll_bar widget gets control.
3. The Value_changed procedure changes an attribute(DwtNy) of work_window
to scroll the work_window as follow.
XtSetArg(arglist[0], DwtNy, -callback_data->value * FONT_HEIGHT);
XtSetValues(w_ary[k_w_work_window], arglist, 1);
4. The result is ....
- The shape of temp1 widget(Child of work_window) is broken.
- But....
The window is shrinked and popuped, the window is completely refreshed.
(Question)
(1). Please tell me why ?
And what happened in this case ?
(2). Is there any solutions on this ?
My customer wants to generate a scrollable work_window that has same
background_pixmap as its parent.
I think it is possible if we have any way to generate a Exposure
Event to the temp1 widget.
Is it possible ?
I think it is possible by function XSendEvent,
but I don't know how to use it.
/*--------(Complete example to reproduce above phenomenon)-------------------*/
$ UIL T3
$ cc/lis t3.c
$ link t3,sys$input/opt
sys$library:decw$dwtlibshr/share
sys$library:decw$xlibshr/share
sys$share:vaxcrtl/share
$ RUN T3
dialbox attr(0:default 1:None 2:ParentRelative): 2
/*--------------------------( t3.c )-----------------------------------------*/
#include <stdio.h>
#include <decw$include/DwtAppl.h> /* DECwindows Toolkit */
#include "t3_include.h"
static Widget w_ary[MAX_WIDGETS];
static DRMHierarchy s_DRMHierarchy; /* DRM database hierarch id */
static char *vec[]={"t3.uid"};
static DRMCode class;
#define FONT_HEIGHT 20
static void value_changed_proc();
static void create_proc();
static DRMRegisterArg regvec[] = {
{"value_changed_proc", value_changed_proc},
{"create_proc", create_proc},
};
static Arg arglist[20]; static int n = 0;
static Widget toplevel, t3_main;
/*
* Main program
*/
int main(argc, argv)
unsigned int argc;
char **argv;
{
int mode;
Arg arg;
printf("dialbox attr(0:default 1:None 2:ParentRelative): ");
fflush(stdout);
scanf("%d", &mode);
DwtInitializeDRM();
toplevel = XtInitialize(
"Hi",
"t3class",
NULL, 0,
&argc, argv);
XtSetArg (arglist[0], XtNallowShellResize, TRUE);
XtSetValues (toplevel, arglist, 1);
if (DwtOpenHierarchy (1, /* number of lines */
vec, /* files */
NULL, /* os_ext_list (null) */
&s_DRMHierarchy)/* ptr to returnd id */
!= DRMSuccess){
printf ("can't open hierarchy");
}
DwtRegisterDRMNames (regvec, XtNumber(regvec));
if (DwtFetchWidget(s_DRMHierarchy, "t3_main",toplevel,&t3_main,&class)
!= DRMSuccess) printf("t3_main fetch error,\n");
XtSetArg(arglist[0], DwtNheight, FONT_HEIGHT * 40);
XtSetValues(w_ary[k_w_work_window], arglist, 1);
XtSetArg(arglist[0],DwtNmaxValue, 40 -1);
XtSetValues(w_ary[k_w_vscroll],arglist,1);
switch (mode) {
case 2:
{
Arg arg;
XtSetArg(arg, DwtNbackgroundPixmap, ParentRelative);
XtSetValues(w_ary[k_w_work_window], &arg, 1);
break;
};
case 1:
{
Arg arg;
XtSetArg(arg, DwtNbackgroundPixmap, None);
XtSetValues(w_ary[k_w_work_window], &arg, 1);
break;
}
};
/* XtSetArg(arg, DwtNbackgroundPixmap, ParentRelative);
XtSetValues(w_ary[k_w_temp1], &arg, 1);
*/
XtManageChild(t3_main);
XtRealizeWidget(toplevel);
XtMainLoop();
}
static void value_changed_proc(widget, tag, callback_data)
Widget widget;
int *tag;
DwtScrollBarCallbackStruct *callback_data;
{
XtSetArg(arglist[0], DwtNy, -callback_data->value * FONT_HEIGHT);
XtSetValues(w_ary[k_w_work_window], arglist, 1);
}
static void create_proc(widget, tag)
Widget widget;
int *tag;
{
w_ary[*tag] = widget;
}
/*--------------------------( t3_include.h )---------------------------------*/
enum {
k_w_work_window, /* 0 */
k_w_vscroll, /* 1 */
k_w_temp1, /* 2 */
};
#define MAX_WIDGETS 3
/*--------------------------( t3.uil )---------------------------------------*/
module t3
version = 'v1.0'
names = case_sensitive
include file 'decw$include:DwtAppl.uil';
include file 't3_include.uil';
value
k_initial_position : 0;
k_font_height : 20;
k_visible_items : 20;
k_scroll_window_height : k_font_height * k_visible_items;
colortable1 : color_table(color('wheat',foreground)='*',
background color=' ');
pixmap1 : icon(color_table=colortable1, '****************',
'****************',
'****************',
'****************',
'****************',
'****************',
'****************',
'****************',
'****************',
'****************',
'****************',
'****************',
'****************',
'****************',
'****************',
'****************',
'****************',
'****************',
'****************',
'****************',
' ',
' ',
' ',
' ',
' ',
' ',
' ',
' ',
' ',
' ',
' ',
' ',
' ',
' ',
' ',
' ',
' ',
' ',
'* * * * * * * * ',
' * * * * * * * *',
'* * * * * * * * ',
' * * * * * * * *',
'* * * * * * * * ',
' * * * * * * * *',
'* * * * * * * * ',
' * * * * * * * *',
'* * * * * * * * ',
' * * * * * * * *',
'* * * * * * * * ',
' * * * * * * * *',
'* * * * * * * * ',
' * * * * * * * *',
'* * * * * * * * ',
' * * * * * * * *',
'* * * * * * * * ',
' * * * * * * * *',
'* * * * * * * * ',
' * * * * * * * *');
procedure
value_changed_proc();
create_proc(integer);
object t3_main : scroll_window {
arguments {
width = 150;
height = k_scroll_window_height;
vertical_scroll_bar = scroll_bar w_vscroll;
work_window = dialog_box w_work_window;
background_pixmap = pixmap1;
};
controls {
scroll_bar w_vscroll;
dialog_box w_work_window;
};
};
object
w_vscroll : scroll_bar {
arguments {
orientation = DwtOrientationVertical;
min_value = 0; max_value = 10;
scroll_bar_inc = 1;
scroll_bar_page_inc = 10;
scroll_bar_value = k_initial_position;
};
callbacks {
value_changed = procedure value_changed_proc();
drag = procedure value_changed_proc();
create = procedure create_proc(k_w_vscroll);
};
};
object
w_work_window : dialog_box {
arguments {
x = 0;
y = - k_font_height * k_initial_position;
units = DwtPixelUnits;
border_width = 0;
};
controls {
dialog_box w_temp1;
};
callbacks {
create = procedure create_proc(k_w_work_window);
};
};
object w_temp1 : dialog_box {
arguments {
units = DwtPixelUnits;
x = 20; y = 80; width = 70; height = 70;
background_pixmap = pixmap1;
};
controls {
label gadget { arguments { label_label = "A"; }; };
};
callbacks {
create = procedure create_proc(k_w_temp1);
};
};
end module;
/*--------------------------( t3_include.uil )-------------------------------*/
value
k_w_work_window :0;
k_w_vscroll :1;
k_w_temp1 :2;
T.R | Title | User | Personal Name | Date | Lines
|
---|