View Full Version : How to differentiate between user resizes and automatic resizes

Caius Caesar
17 Jan 2012, 8:13 AM
When I make a component resizable, I can subscribe to the resize event of the resizer to receive only user-caused resizes. However, I need the automatic resizes too, so I subscribe to the resize event of the component as well. The problem is that when a user resizes the component, both resize events are fired. I need to be able to differentiate between these two, so ideally I wouldn't want the normal resize event when a user resizes the component (I don't get the resizer resize event when the component is automatically resized, so in that case there is no problem).

Any ideas would be much appreciated!



17 Jan 2012, 9:01 AM
I usually cheat and set a property on the class and check it in the event to differentiate.

Caius Caesar
18 Jan 2012, 12:59 AM
As it happens, that doesn't do it for me, cause I want just one resize event in case of manual resize, not two. The way I did it now seems to work:

I subscribe only to the resize event of the component, not that of the resizer
I also subscribe to the beforeresize event of the resizer
In the beforeresize eventhandler, I set component.inManualResize to true
in the resize eventhandler I'm able to differentiate between manual and automatic resize

This seems to work for me