From: Conal E. <co...@co...> - 2007-11-28 06:09:25
|
I want to make (or find) a float-valued slider that displays its current value and maybe its bounds. Does anyone have advice about doing that sort of thing. I want the result to have have a control-like interface, including a gettable attribute for the current (float) value. Thanks, - Conal |
From: Mads <mad...@ya...> - 2007-11-28 17:54:11
|
Hi Conal Elliott wrote: > I want to make (or find) a float-valued slider that displays its > current value and maybe its bounds. Does anyone have advice about > doing that sort of thing. I want the result to have have a > control-like interface, including a gettable attribute for the current > (float) value. Thanks, - Conal To have a gettable attribute you need to make the type containing the slider an instance of Valued. See http://wxhaskell.sourceforge.net/doc/Graphics.UI.WX.Classes.html#t% 3AValued and: import qualified Graphics.UI.WX as Wx instance Wx.Valued YourTypeContainingTheSlider where value = Wx.newAttr "Value" ioActionToGetValue ioActionToSetValue there is also other classes you can make your type an instance of. See the link above. You should properly make it an instance of Widget as a minimum. I also asked about something similar before. I got this reply http://www.mail-archive.com/wxh...@li.../msg00260.html . Greetings, Mads Lindstrøm |
From: Conal E. <co...@co...> - 2007-11-29 01:44:07
|
Thanks much for the pointers, Mads. I read the binview source code, which uses a global mutable table to store per-instance data. I wonder if there'= s a nicer way. did you ever find one? - Conal On Nov 28, 2007 9:47 AM, Mads Lindstr=F8m <mad...@ya...> wrote: > Hi > > Conal Elliott wrote: > > I want to make (or find) a float-valued slider that displays its > > current value and maybe its bounds. Does anyone have advice about > > doing that sort of thing. I want the result to have have a > > control-like interface, including a gettable attribute for the current > > (float) value. Thanks, - Conal > > To have a gettable attribute you need to make the type containing the > slider an instance of Valued. See > http://wxhaskell.sourceforge.net/doc/Graphics.UI.WX.Classes.html#t% > 3AValued and: > > import qualified Graphics.UI.WX as Wx > > instance Wx.Valued YourTypeContainingTheSlider where > value =3D Wx.newAttr "Value" ioActionToGetValue ioActionToSetValue > > there is also other classes you can make your type an instance of. See > the link above. You should properly make it an instance of Widget as a > minimum. > > I also asked about something similar before. I got this reply > > http://www.mail-archive.com/wxh...@li.../msg0026= 0.html. > > > Greetings, > > Mads Lindstr=F8m > > > |
From: Mads <mad...@ya...> - 2007-11-29 16:28:20
|
Hi Conal > Thanks much for the pointers, Mads. I read the binview source code, > which uses a global mutable table to store per-instance data. I > wonder if there's a nicer way. did you ever find one? - Conal No. I did not even use the binview-way. I decided that I did not need it enough to go with the binview-way :( To be fair, I did not look very hard for a nicer solution. Greetings, Mads Lindstrøm > > On Nov 28, 2007 9:47 AM, Mads Lindstrøm <mad...@ya...> > wrote: > Hi > > > Conal Elliott wrote: > > I want to make (or find) a float-valued slider that displays > its > > current value and maybe its bounds. Does anyone have advice > about > > doing that sort of thing. I want the result to have have a > > control-like interface, including a gettable attribute for > the current > > (float) value. Thanks, - Conal > > > To have a gettable attribute you need to make the type > containing the > slider an instance of Valued. See > http://wxhaskell.sourceforge.net/doc/Graphics.UI.WX.Classes.html#t% > 3AValued and: > > import qualified Graphics.UI.WX as Wx > > instance Wx.Valued YourTypeContainingTheSlider where > value = Wx.newAttr "Value" ioActionToGetValue > ioActionToSetValue > > there is also other classes you can make your type an instance > of. See > the link above. You should properly make it an instance of > Widget as a > minimum. > > I also asked about something similar before. I got this reply > http://www.mail-archive.com/wxh...@li.../msg00260.html . > > > Greetings, > > Mads Lindstrøm > > > |