PDA

View Full Version : split button: how to change icons following user choice ?



vonbert
17 May 2010, 1:21 AM
Hello, please can anyone tell me if it is possibile within a extjs toolbar , to have a SPLIT BUTTON that will change the displayed icon in toolbar (and the related action ) following the choices that user will do from the drop down menu of the split button?

The aim is to have something like photoshop tool split-button that will display different icon depending on what sub-button is checked.

I mainly wish to know if it possbile to do it.. then obviosuly i'll be very happy if someone can post some example or info to know "how to" .. thank you in advance :)

wm003
17 May 2010, 1:33 AM
Have you tried Ext.Cyclebutton? Otherwise i guess you will need to add an eventListener to change the icon manually by using the methods setIcon() or setIconClass() from the SplitButton Object

vonbert
17 May 2010, 3:54 AM
Im a newbie, and not expert of js, but from what i red it seem to me that the ext.cyclebutton will "cycle" over different option while clicking over it.. while i would need a solution where the actual option displayed in the split-button could just be changed via-dropdown menu activated with the little down-arrow in the right part of the split-button..
I need to create a multifunction button such as "(icon) + design" ... then the various option can be : design-line, design-circle, design-rectangle, selecting one option will display the correct icon over the split-button and activate the instrument..
Clicking on the main part of the button must not cycle through options but just activate the selected/visible option..
aw.. tx!

wm003
17 May 2010, 8:59 PM
So, try my second suggestion:

"Otherwise i guess you will need to add an eventListener to change the icon manually by using the methods setIcon() or setIconClass() from the SplitButton Object"

With these methods within the handler-function of the SplitButton you should be able to do what you want, as there does not exists a readymade widget with your requirements yet afaik.

vonbert
18 May 2010, 6:50 AM
Actually the programmers where i work will follow your 1st suggestion.. to use the basic ext.cyclebutton modifying its behaviour with some little "add on" .
thank you mr. wm003 ! :)