From: Axel S. <A....@ke...> - 2006-10-20 16:31:48
|
Brett, On Thu, 2006-10-19 at 10:47 -0600, Brett Giles wrote: > Yes, it was easy. Attached is a mdialog.glade file that I used. >=20 > The code to run it is (in your main... or wherever) >=20 > messageDialog <- xmlGetWidget qsXml castToDialog "shortMessageDialog" > mdMessage <- xmlGetWidget qsXml castToLabel "dialogMessage" >=20 > And then wherever... >=20 > Left error -> do > mdMessage `labelSetText` error > messageDialog `afterResponse` (\_ -> widgetHideAll messageDialog) > widgetShowAll messageDialog >=20 > Of course, this can be improved / encapsulated further, e.g. having a > "cancel" response, "OK" / "Retry" functions etc.... I guess it is actually easier to use the MessageDialog widget for these purposes. Since your question has come up before, I've now added this widget to the darcs repository. It will be in the next release. Thanks for your input, Axel. > Axel's reply: > > On Wed, 2006-10-18 at 21:38 -0600, Brett G. Giles wrote: > >> I've noticed this too. I actually tried to use a MessageDialog in a > >> program and couldn't see how to get it working. I ended up creating m= y > >> own. > > > > That was actually the intention. The API for MessageDialog isn't that > > exciting and contains variadic functions that are difficult to bind in > > Haskell. It should be much easier to rewrite the functionality of > > MessageDialog in Haskell, using Dialog. > > > > That said, we should supply this implementation in Gtk2Hs, so yes, it's > > an omission. > > > > We'll add this in the next release. > > > > Axel. > > > >> On Thu, 2006-10-19 at 00:19 -0200, Maur=C3=83=C2=AD=C3=82=C2=ADcio wro= te: > >> > Hi, > >> > > >> > Page > >> > > >> > http://haskell.org/gtk2hs/docs/current/Graphics-UI-Gtk-Windows-Dialo= g.html > >> > > >> > says you can "use MessageDialog to save yourself some effort", but > >> link > >> > to MessageDialog doesn't work. > >> > > >> > Best, > >> > Maur=C3=83=C2=ADcio > >> > > > > >=20 >=20 > Brett Giles > Grad Student, Formal Methods UofC > http://pages.cpsc.ucalgary.ca/~gilesb |