Conversation
|
I got an issue open #32 to review events for controls. Having a click event for Image, or any control would be useful. I am however wondering what the purpose for this control is? One can customize visual style via CSS, if you want buttons that look different. Just trying to keep the number of controls simple and generic. Can you describe the use scenario for this? |
|
I'm just wondering if it's enough to add events to the Image class. And then you can for instance make a sub-class where you set the different images. (Though I need to #81 for that.) |
|
Thomas, I made a short movie to demonstrate the use of it. The dialog is made completely with SKUI, all the icons are ImageButtons. Guy architectuurburo wydouw bvba Hoevensebaan 238 | 2950 Kapellen Op 26-jan.-2014, om 20:27 heeft Thomas Thomassen notifications@github.com het volgende geschreven:
|
|
Right, I think I'd prefer to modify the existing controls to allow subclassing. As this is practically a button - or an image with events. I want to avoid hybrids. Give me a couple of days to tweak it. |
Image button with images for default and active state (mouse down)
Methods:
ImageButton.file=
ImageButton.activestatefile=
Event:
ImageButton.on( :click ) {|control| ... }
example toggle image button:
@@active_toggle = false
img_active = SKUI::ImageButton.new(css_path + "icons/off_red.png",css_path + "/icons/off_red_pushed.png")
img_active.on( :click ) {
if @@active_toggle == false
img_active.file = (css_path + "/icons/on_green.png")
img_active.activestatefile = (css_path + "/icons/on_green_pushed.png")
@@active_toggle = true
else
img_active.file = (css_path + "/icons/off_red.png")
img_active.activestatefile = (css_path + "/icons/off_red_pushed.png")
@@active_toggle = false
end
}
@@skui.add_control(img_active)