comp.lang.ada
 help / color / mirror / Atom feed
From: cgreen@yosemite.atc.com (Christopher Green)
Subject: Re: Ada and X/Motif
Date: 1997/06/09
Date: 1997-06-09T00:00:00+00:00	[thread overview]
Message-ID: <5nhbov$9m9@newshub.atmnet.net> (raw)
In-Reply-To: 3394CED4.2BF7@interlog.com


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? 

Since XStoreColor() does not return a status to indicate whether it
succeeded, the only way to determine whether the color was stored is
to observe it on the display.  For this to happen, the colormap must
also have been installed; XSetWindowColormap() does this (actually,
the window manager detects the colormap change and installs the color-
map).  So either XSetWindowColormap() must also be called in the sub-
program; or the subprogram must return the colormap, and the main pro-
gram must call XSetWindowColormap().

Just as a place to start looking, I'd look for variables that may not be
correctly passed between main and subprogram, or variables that do not 
have an adequate lifetime when the binding functions are called from the 
subprogram.  Remember that many X Window System objects are represented
by C pointers, and a C pointer to a local variable becomes a dangling 
pointer when the subprogram returns.

Chris Green                                  Email cgreen@atc.com
Advanced Technology Center                   Phone (714) 583-9119
22982 Mill Creek Drive                                   ext. 220
Laguna Hills, CA 92653                       Fax   (714) 583-9213




  parent reply	other threads:[~1997-06-09  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 [this message]
1997-06-10  0:00   ` Uliyana Markova
1997-06-10  0:00   ` Jeff W. Boote
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox