From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=0.6 required=5.0 tests=BAYES_20,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103734,fe9dd44acd5462d1 X-Google-Attributes: gid103734,public X-Google-Thread: 103376,fe9dd44acd5462d1 X-Google-Attributes: gid103376,public X-Google-Thread: 10b6ac,fe9dd44acd5462d1 X-Google-Attributes: gid10b6ac,public From: Uliyana Markova Subject: Re: Ada and X/Motif Date: 1997/06/10 Message-ID: <339DA0B0.35C9@array.ca>#1/1 X-Deja-AN: 247515288 References: <3394CED4.2BF7@interlog.com> <5nhbov$9m9@newshub.atmnet.net> Organization: UUNET Canada News Transport Newsgroups: comp.lang.ada,comp.windows.x,comp.windows.x.motif Date: 1997-06-10T00:00:00+00:00 List-Id: Christopher Green wrote: > > In article <3394CED4.2BF7@interlog.com>, Uliyana Markova 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