Can someone please point me in the right direction when it comes to changing properties of an element in Gtk2Hs.
For example, how do I change the background-color of a DrawingArea?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There are various methods for modifying a widget’s style. For example to modify the background style you can use
widgetModifyBg(corresponding to the C functiongtk_widget_modify_bg()). In principle, if you change the style for one state (e.g. StateNormal) then you should also change it for the others.Y would suggest you describe the styles you want in an RC file, and then load that file from your application, but it seems that functions like
gtk_rc_parse()are not bound in gtk2hs.Here’s an example:
If you need to do custom drawing based on a widget’s styles, you can do that using
widgetGetState, thewidgetStyleproperty and thestyleGet*family of functions (e.g.styleGetText). Here’s an example of that: