Send Beginners mailing list submissions to
        beginners@haskell.org

To subscribe or unsubscribe via the World Wide Web, visit
        http://www.haskell.org/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
        beginners-requ...@haskell.org

You can reach the person managing the list at
        beginners-ow...@haskell.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."


Today's Topics:

   1.  How to switch off a RadioMenuiItem? (Pierre Michallet)


----------------------------------------------------------------------

Message: 1
Date: Sun, 26 Aug 2012 22:50:09 +0200
From: "Pierre Michallet" <p.michal...@free.fr>
Subject: [Haskell-beginners] How to switch off a RadioMenuiItem?
To: "beginners haskell" <beginners@haskell.org>
Message-ID: <868D84E71F204D399FF858E28799CB10@medione9995867>
Content-Type: text/plain; charset="iso-8859-1"

Using Glade, I have created a menu which,among other things,has 2 
radioMenuItems located in the same submenu.
Both are in the off state when the program starts.
In the following, I will refer to them as "initiationCB" and "beginnerCB".
The expected behavior is that these 2 options are exclusive ie clicking one 
when in the OFF state will turn it ON and turn the other OFF.
In fact, the first time I click on "initiationCB" its associated checkbox is 
turned ON; a second click on it will not change its state.  
When "beginnerCB" is then clicked, it is turned ON but "initiationCB" is not 
turned OFF as expected, and from then on, the two items are ON and there is no 
way to  turn them OFF.
One surprising thing is that in the same menu there are 2 CheckMenuItems which, 
when clicked, change their state without any code written to obtain this 
behavior.
I would have expected the same from RadioMenuItems.
In an attempt to switch a RadioMenuItem OFF , I have added the following code:

                  on initiationCB menuItemActivate
                       do  checkMenuItemSetActive initiationCB True

When "initiationCB" is clicked (and turned ON as a consequence) the program 
blows up seeming in an infinite recursion.

The Gtk2HS tutorial (chapter 7.2) gives an example of selective choices by 
defining actions in the file called by a UIManager to get the elements of the 
user
interface and RadioActionEntry in the code.
The problem is that I could not succeed in associating an action to a menu item 
in the Glade file (as done in the tutorial), and in case of success, I don't 
know whether a
XmlGetWidget instruction would recognize it.

So the question is : is there a way to implement a solution similar to the one 
described in the tutorial using Glade instead of the UIManager approach?

Another odd thing to me is that the signal menuItemToggle is not raised when a 
radioMenuItem is clicked.

Thanks in advance for your help

p.michal...@free.fr
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://www.haskell.org/pipermail/beginners/attachments/20120826/d03a26ba/attachment-0001.htm>

------------------------------

_______________________________________________
Beginners mailing list
Beginners@haskell.org
http://www.haskell.org/mailman/listinfo/beginners


End of Beginners Digest, Vol 50, Issue 30
*****************************************

Reply via email to