Graphics.UI.GLUT has a Dial and Button callback. I don't find any example of use of this callback. I wanted to have one because currently I use the keyboard and the mouse callbacks and this is not enough and not user-friendly.
I've tried to do one such callback. In my program:
dial :: IORef GLdouble -> DialAndButtonBoxCallback
dial zoom index =
case index of
DialAndButtonBoxDial 1 1 -> zoom $~! (+1)
_ -> return ()
Then I expect to see a button (button 1
) in the OpenGL window which would increment zoom
when I press on this button (zoom $~! (+1)
zooms the graphic, I use it in the keyboard callback currently, no problem with that).
Then in my main
file:
zoom <- newIORef 0.0
dialAndButtonBoxCallback $= Just (dial zoom)
The code compiles. But when I run the program, there's no dialog box appearing anywhere.
I would appreciate any help. Maybe I have to create a dialog box first ? I don't see anything like this in the documentation.
A dial and button box is not a dialog box. It’s a special purpose type of hardware, like a mouse, keyboard, joystick, or steering wheel. Eg this company makes some.
Glut is not a gui library like gtk. It lets you get user input and draw things on the screen. You need to figure out exactly how to draw all your user interface components if you want to use glut