PDA

View Full Version : Firefox cursor bug fix and inputType choice for Ext.Msg.show()



jsakalos
11 Mar 2008, 5:12 PM
Hi all,

I sometimes use Ext.Msg for small user inputs, such as passwords so I needed to fix firefox cursor bug and also I wanted to be able to set "password" input type of the Ext.Msg input.

So here is the fix (I've just written it, not tested thoroughly so all your inputs are welcome):



// Ext.Msg input type and firefox cursor bug fix
Ext.Msg.show = Ext.Msg.show.createInterceptor(function(config) {
// get inputType
var inputType = config.inputType || 'text';

// get dialog content element
var content = Ext.Msg.getDialog().body.child('div.ext-mb-content');

// set inputType
content.down('input').set({type:inputType});

// fix firefox cursor bug
var overflow = config.cursorFix ? 'auto' : 'hidden';
if(Ext.isGecko) {
content.applyStyles({overflow:overflow});
}
}, Ext.Msg);

You would include this fix early in your code (before you display your first message box). Method show now recognizes two new configuration properties:

cursorFix:true (or false, or omit it at all) - if true fixes the firefox cursor bug
inputType:'password' (or text, or omit it at all) - type of input (defaults to 'text')

Enjoy.

mystix
11 Mar 2008, 7:05 PM
don't have a use case for this now, but thanks for the sweet cursor hack! :D

[edit]
looks like that firefox fix already made it into ext-all.css SVN rev 1752 (committed by jack) :)


.ext-gecko .ext-mb-fix-cursor{overflow:auto;}

(with a related fix in MessageBox.js in SVN rev 1756)