[gtkada] Passing context objects to handlers via Register_Handler

Nicolas Setton setton at adacore.com
Mon Jan 9 22:14:02 CET 2017


Hello,

On 09/01/2017 12:41, R. Tyler Croy wrote:
> Before I do something gnarly and add some globals to my application, I'm
> curious to learn more about patterns for sharing context with registered
> handlers.
>
> I'm using Glade3 and GtkAda (written about a bit here
> http://unethicalblogger.com/2017/01/07/updated-glade-gtkada-example.html)

Nice post! I like the concept of "frivolous hacking" - is it the fun 
sibling to "deliberate learning"? :-)

(snip)

> The problem I have is that there is shared state which I have in the Main
> procedure which I would like to make use of during the handler procedures. My
> first attempt was create a new Gtkada_Builder_Record type with a record
> extension, but that failed miserably.
>
> Outside of adding a global which I grab across package boundaries, it's not
> clear to me how to pass 'context' here :(
>
>
> Any suggestions or pointers would be most helpful!

Your first idea, to extend Gtkada_Builder_Record, looks like the right 
thing to do - what didn't work?

Best regards,

Nicolas






More information about the gtkada mailing list