From: Uliyana Markova <uliyana@array.ca>
Subject: Re: Ada and X/Motif
Date: 1997/06/10
Date: 1997-06-10T00:00:00+00:00 [thread overview]
Message-ID: <339DA0B0.35C9@array.ca> (raw)
In-Reply-To: 5nhbov$9m9@newshub.atmnet.net
Christopher Green wrote:
>
> In article <3394CED4.2BF7@interlog.com>, Uliyana Markova <markovi@interlog.com> wrote
:
> >I am programming a user interface in Ada using X/Motif routines. The
> >interface between X and Ada is implemented through X bindings.
> >I have the following problem: to create a colormap, allocate colors
> >and store a color I call consequently the bindings for
> >XCreateColormap, XAllocColorCells and XStoreColor. When these
> >functions are called in the main ada routine, they work properly.
> >If I call any (or all) of the above functions in a separate procedure
> >and then call this procedure in the main routine, the XStoreColor
> >function does not store the color in the colormap. There is no error
> >message, just the function does not do what it is supposed to do. Any
> >help?
>
> Any chance you could post or email an example, and provide information
> on what Ada compiler, set of bindings, and X11 implementation you are
> using?
Thanks a lot for responding. I am sorry I did not specify the versions
on a first place. I am using X11 Release 5, the ada compiler is
VADSself Version 6.2.3-0 and the ada bindings are downloaded from the
DEC's web site.
Here is an example of one of a version that does not work.
------------------------------
with X_Lib;
with Xt;
with X;
with Xm_String;
with System;
package Color_Pkg is
procedure Color;
end Color_Pkg;
package body Color_Pkg is
colormap : X.Colormap_Type;
pixel_cells : X_Lib.Vector_Of_Colormap_Index_Type ( 1..256 ) :=
( others => X_Lib.Colormap_Index_Init);
package Manipulate_Colormap is new Xt.Manipulate_Avt (
X.Colormap_Type );
procedure Color is
plane_masks : X_Lib.Vector_Of_Plane_Mask_Type ( 1..0 );
dpy : X_Lib.Display_Type;
screen_num : X_Lib.Screen_Number_Type;
Visual_Info : X_Lib.Visual_Info_Type;
toplevel : Ip_Toplevel.Toplevel_Widget;
al : Xt.Arg_List_Type ( 0..0 );
color : X_Lib.Color_Type;
color_test : X_Lib.Color_Type;
success : Boolean;
begin
-- application initialize - create toplevel widget
dpy := Xt.Display ( Xt.Widget_Type ( toplevel) );
screen_num := X_Lib.Screen_Number_Of_Screen (
X_Lib.Default_Screen_Of_Display ( dpy ) );
X_Lib.Match_Visual_Info ( success,
dpy, screen_num, X_Lib.Depth_Type ( 8),
X_Lib.Pseudo_Color,
Visual_Info );
if ( success ) then
colormap := X_Lib.Create_Colormap (
dpy,
X_Lib.Default_Root_Window ( dpy ),
Visual_Info.Visual.all,
X_Lib.All_Of_Them );
end if;
X_Lib.Alloc_Color_Cells (
success,
dpy,
colormap,
False,
plane_masks ( 1..0 ),
pixel_cells );
al ( 0 ) := ( Xm_String.NColormap_Ptr,
Manipulate_Colormap.To_Avt ( colormap ) );
Xt.Set_Values ( Xt.Widget_Type ( toplevel ),
al ( 0..0 ) );
color.pixel := X_Lib.Colormap_Index_Type ( pixel_cells ( 4 ) );
color.Do_Red := True;
color.Do_Green := True;
color.Do_Blue := True;
color.Red := X_Lib.Color_Intensity_Unsigned_Short_Subtype (
65535 );
color.Green := X_Lib.Color_Intensity_Unsigned_Short_Subtype (
0 );
color.Blue := X_Lib.Color_Intensity_Unsigned_Short_Subtype (
0 );
X_Lib.Store_Color (
dpy,
colormap,
color);
color_test.pixel :=
X_Lib.Colormap_Index_Type ( pixel_cells ( 4 ) );
-- returns always black color
X_Lib.Query_Color (
dpy,
colormap,
color1 );
-- realize toplevel and start the event loop
end Color;
end Color_Pkg;
with Color_Pkg;
procedure Color is
begin
Color_pkg.Color;
end Color;
Note that a new colormap is installed. All it's entries contain the
black color ( r=0, g=0, b=0 ).
Uliyana Markova
------
Array Systems Computing Inc.
1120 Finch Ave. West, 8th Floor
North York, Ontario, Canada M3J 3H7
Tel.: 416-736-0900 ext 280
e-mail: uliyana@array.ca
prev parent reply other threads:[~1997-06-10 0:00 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
1997-06-03 0:00 Ada and X/Motif markovi
1997-06-04 0:00 ` jim hopper
1997-06-04 0:00 ` Martin C. Carlisle
1997-06-09 0:00 ` Christopher Green
1997-06-10 0:00 ` Jeff W. Boote
1997-06-10 0:00 ` Uliyana Markova [this message]
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox