
Hello list, let's say I would like to create 4 buttons where any one button can respond to a click and notify every other button. Ie. where the 1st button is wired with the 2nd, the 2nd with the 3rd ... and the 4th button with the 1st. In short I would like these buttons to be connected as in a cyclic list. Is that something that MonadFix is meant to be used for? Günther

On Thu, Jun 24, 2010 at 02:35:55AM +0200, Günther Schmidt wrote:
Is that something that MonadFix is meant to be used for?
In current Gtk libraries, no. You'll do something like do btns <- mapM createBtn [1..4] mapM_ connect $ zip btns (tail $ cycle btns) However, if some library required you to supply the action while constructing the button, then I guess the answer would be "yes". Cheers, -- Felipe.

Hello Felipe, Thursday, June 24, 2010, 5:00:55 AM, you wrote:
Is that something that MonadFix is meant to be used for?
In current Gtk libraries, no. You'll do something like However, if some library required you to supply the action while constructing the button, then I guess the answer would be "yes".
he may have his own high-level abstractions that combine create and connect, in this case the answer is yes: rdo btn1 <- createAndConnectBtn btn2 btn2 <- createAndConnectBtn btn3 btn3 <- createAndConnectBtn btn1 -- Best regards, Bulat mailto:Bulat.Ziganshin@gmail.com
participants (3)
-
Bulat Ziganshin
-
Felipe Lessa
-
Günther Schmidt