[gtkada] Addressing external data in a GUI

Rick Duley 30294025 at student.murdoch.edu.au
Tue May 31 09:51:09 CEST 2005


Hi Preben

When the User alters an editable in my GUI I was planning to alter the 
data the
editables represent.  It seemed logical to use a callback to write the 
new data
to the relevant variable.

I cannot find any way in the documentation to send the address of the variable
to a callback so I am assuming the variable has, some how, to be globally
visible.  The obvious way to do this is to have an access type visible to the
callback and initialised to the address of the data.  This seems an awfully C
technique and to be in defiance of Ada practices of encapsulation and
information hiding - not to mention being a naughty use of aliases.

How else can I alter program data from a GUI?

Cheers
-------------------------------------------
"Professional qualitative judgement
    consists in knowing the rules
      for using (or occasionally breaking)
        the rules."
                             D. Royce Sadler
-------------------------------------------
Rick Duley
Murdoch University
School of Engineering Science
Perth, Western Australia
http://eng.murdoch.edu.au/~rick
aussie : 040 910 6049                .-_|\
o'seas : + 61 40 910 6049           /     \
                               perth *_.-._/
                                          v


Quoting Preben Randhol <randhol+gtkada at pvv.org>:

> On Tue, May 31, 2005 at 02:41:33PM +0800, Rick Duley wrote:
>> Hi folks
>>
>> I think the penny might just have dropped.
>>
>> GtkAda imports C routines.  Therefore: the only way to address data
>> from (say) callbacks is to have a public (global in C) access type
>> (pointer in C) to the data visible to the callback.  In other words,
>> write Ada code to pull C tricks!
>>
>> Is this right?
>
> Not sure what you want to do. Why do you want to pass data through
> callbacks?
>
>
> --
> Preben Randhol -------------- http://www.pvv.org/~randhol/Ada95 --
>                  ?For me, Ada95 puts back the joy in programming.?
>





More information about the gtkada mailing list