comp.lang.ada
 help / color / mirror / Atom feed
From: Preben Randhol <randhol+abuse@pvv.org>
Subject: Re: Gtkada-Prob
Date: Wed, 21 Nov 2001 09:38:10 +0000 (UTC)
Date: 2001-11-21T09:38:10+00:00	[thread overview]
Message-ID: <slrn9vmtc6.tb.randhol+abuse@kiuk0156.chembio.ntnu.no> (raw)
In-Reply-To: 20011121.053507.496987743.3460@web.de

On Wed, 21 Nov 2001 05:35:08 +0100, Lars Heppler wrote:
> Hi!
> I have a little problem, i want to write a gtkada-programm, where you can
> select some options with Radiobuttons and Checkbuttons. Do I need a
> Handler to find out if the bottons are active or not ? I used Glade to
> make the gui. 

Yes. You need a handler. As Radio and checkbuttons are derivatives from
toggle button and do not have additional signals of their own, you use
the "toggled" signal inherited from toggle buttons. What I did with some
radio buttons I have was to make an Enumerated type :

type Method_Enum_Type is (Spell, MultipleChoice, Noun);

and I defind a Callback package like this: 

   package Method_Callback is new
         Gtk.Handlers.User_Callback (Gtk_Radio_Button_Record,
                                     Method_Enum_Type);
                                      
I then hooked the radio buttons to the the "toggled" signal as:

Method_Callback.Connect
     (Gui_Setup.Spell_R_Button, "toggled", 
      Method_Callback.To_Marshaller (On_Method_Radio_Button_Toggle'Access),
      Spell);

This means that if this button is toggled it will send Spell as the user
data to the On_Method_Radio_Button_Toggle procedure which I wrote like
this:


   procedure On_Method_Radio_Button_Toggle
      (Object : access Gtk_Radio_Button_Record'Class;
       Method : Method_Enum_Type) is
   begin
      -- Need to check if the button is active or not as a
      -- deactivated button will also send this signal
      -- when it is toggled from an active state.

      if Get_Active (Object) = True then 
         -- Do your stuff here :-)
         Setup.Examine_Method := Method;
      end if;
   end On_Method_Radio_Button_Toggle;

But you don't have to use an Enumerated type you can use Integer, Chars,
String etc...

But there may be much better solutions to this which is more elegant, if
somebody has one I would very much like to learn it too :-)

> My problem is now that i want to start a spawn with the arguments
> selected thru the buttons. 

Can you explain this a bit more? I'm not sure I understand the word
spawn (English not my first language)

>I think my problem has also to do
> with Type Conversion... i looking now for a couple of days to solve this
> and i also didn`t find somewhere else (mailing-list...) an answer. I hope
> you can give me hints.

You should join the GtkAda mailinglist if you haven't already.

Preben
-- 
 ()   Join the worldwide campaign to protect fundamental human rights.
'||}
{||'                                           http://www.amnesty.org/



  parent reply	other threads:[~2001-11-21  9:38 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-11-21  4:35 Gtkada-Prob Lars Heppler
2001-11-21  9:37 ` Gtkada-Prob Adrian Knoth
2001-11-21 18:52   ` Gtkada-Prob Preben Randhol
2001-11-21  9:38 ` Preben Randhol [this message]
2001-11-21 10:02   ` Gtkada-Prob Count Zero
2001-11-21 17:06   ` Understanding Booleans Jeffrey Carter
2001-11-21 17:19     ` Jean-Marc Bourguet
2001-11-21 17:29     ` Preben Randhol
2001-11-21 20:05       ` Stephen Leake
2001-11-21 21:33         ` Florian Weimer
2001-11-22  4:23     ` Robert Dewar
2001-11-22 10:39       ` Preben Randhol
2001-11-22 15:51       ` Rod Chapman
2001-11-23  3:51         ` Robert Dewar
2001-11-24 20:09     ` Richard Riehle
2001-11-25  9:08       ` Pascal Obry
2001-11-25 15:06         ` Florian Weimer
2001-11-27  9:46           ` AG
2001-11-25 21:44       ` Jeffrey Carter
2001-11-21 10:19 ` Gtkada-Prob Florian Weimer
2001-11-21 10:36   ` Gtkada-Prob Preben Randhol
2001-11-21 10:39   ` Gtkada-Prob Count Zero
2001-11-21 10:50     ` Gtkada-Prob Preben Randhol
2001-11-21 10:57       ` Gtkada-Prob Lars Heppler
2001-11-21 11:53         ` Gtkada-Prob Preben Randhol
2001-11-21 12:24           ` Gtkada-Prob Florian Weimer
2001-11-21 12:57             ` Gtkada-Prob Preben Randhol
2001-11-21 17:33     ` Gtkada-Prob Adrian Knoth
2001-11-22 10:32       ` Gtkada-Prob Preben Randhol
2001-11-22 16:36         ` Gtkada-Prob Adrian Knoth
2001-11-22 21:13         ` Gtkada-Prob Jeffrey Carter
2001-11-23 10:17           ` Gtkada-Prob Preben Randhol
2001-11-26  6:47             ` Use of use, was Gtkada-Prob Anders Wirzenius
2001-11-26  9:25               ` Preben Randhol
2001-11-27  6:28                 ` Anders Wirzenius
2001-11-27 14:06                   ` Stephen Leake
2001-11-23 17:26 ` Gtkada-Prob Arnaud Charlet
replies disabled

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