PDA

View Full Version : [FIXED][3.0rc2] Ext.MessageBox.setIcon(...) before dialog is shown => error



sebsei
23 Jun 2009, 2:10 AM
Ext version tested:



Ext 3.0-rc2





Browser versions tested against:



____

FF3





Operating System:



Windows Vista





Description:



Error given: "iconEl is undefined"





Test Case:






Ext.MessageBox.setIcon(Ext.MessageBox.ICON);
Ext.MessageBox.alert("This line will not be executed", "...");







Steps to reproduce the problem:



Just write the above code.





The result that was expected:



Ext.MessageBox should either initiate the dialog at this point or save the icon for later use.





The result that occurs instead:



Error: "iconEl is undefined"






Debugging already done:



As also mentioned above a call to this.getDialog() in the Ext.MessageBox.setIcon() method would solve the issue. Otherwise setIcon() should check if the dialog has been initiated, and if not it should save the icon in a variable for later use.





Possible fix:



One could just switch the two lines in the code example arround, like this:






Ext.MessageBox.alert("This line will not be executed", "...");
Ext.MessageBox.setIcon(Ext.MessageBox.ICON);





Though it would still be a little handier if it didn't result in an error.




PS: Props for the great work you have done here. Keep it up!

evant
23 Jun 2009, 4:10 AM
OP is right, but this is fairly minor with an easy work around, we'll look at this at some point.

sebsei
25 Jun 2009, 4:56 AM
OP is right, but this is fairly minor with an easy work around, we'll look at this at some point.

You are right.

Furthermore, I discovered that the shadow isn't calulated right when using code similar to that above.

Se attached screenshot.

It seems to me as Ext measures the text's size and places the shadow according to that. Then the icon is applied, but the shadow isn't adjusted.

evant
12 Jul 2009, 6:38 PM
I can't verify the second behaviour, can you post a test case?

evant
12 Jul 2009, 7:41 PM
Sorry I see what you're saying. The setIcon method needs to be called before the MessageBox is shown, I've updated the docs accordingly. You can now call setIcon the first time before the dialog is shown, so the initial issue is resolved.

Marking this as tenatively fixed.