1. #11
    Ext User
    Join Date
    Jun 2007
    Posts
    37
    Vote Rating
    0
    quilleashm is on a distinguished road

      0  

    Default


    Fix for the gif file. Two of the images were one pixel too narrow.
    Attached Images

  2. #12
    Ext User
    Join Date
    Aug 2007
    Posts
    32
    Vote Rating
    0
    Joy is on a distinguished road

      0  

    Arrow ColorField With Alpha

    ColorField With Alpha


    Hey,
    your ColorField seems perfect!
    but I guess it also can be extended with "NoColor" and "Transparency" (slider) controls,
    by default, color is transparent ... (screen's in attach)
    Now I need to use extended color palette with alpha channel defining. So, simply color is defined with 4bytes, for example: #FF00FF00, where leading byte is alpha channel. This color format is standart for ChartDirector library for example. I really understand that this is not so important for usual needs, but I need it very much.
    Have anybody any ideas/ready examples about this topic?
    Attached Images

  3. #13
    Ext User stevefink's Avatar
    Join Date
    Aug 2007
    Posts
    117
    Vote Rating
    0
    stevefink is on a distinguished road

      0  

    Default


    Is there documentation available for extending Ext's base without actually altering it? I'd love to try some of the samples here for a project I'm working on. I'd rather stuff the code in an adjacent file than modifying ext's source.

    Thanks :-)

    - sf

  4. #14
    Sencha User
    Join Date
    Mar 2007
    Posts
    186
    Vote Rating
    0
    Nullity is on a distinguished road

      0  

    Default


    Just paste the code into a new text file with a .js extension then source it after the Ext files. So if you name the file 'ColorField.js', the header of your page will contain something like this:

    HTML Code:
    <script type="text/javascript" src="/ext/adapter/ext/ext-base.js"></script>
    <script type="text/javascript" src="/ext/ext-all.js"></script>
    <script type="text/javascript" src="ColorField.js"></script>

  5. #15
    Ext JS Premium Member stever's Avatar
    Join Date
    Mar 2007
    Posts
    1,406
    Vote Rating
    6
    stever will become famous soon enough stever will become famous soon enough

      0  

    Default [2.0] New rev of ColorField

    [2.0] New rev of ColorField


    I'm having a problem where sometimes FireFox gives this sporatic error:

    [Exception... "'Permission denied to get property HTMLDivElement.nodeType' when calling method: [nsIDOMEventListener::handleEvent]" nsresult: "0x8057001e (NS_ERROR_XPC_JS_THREW_STRING)" location: "<unknown>" data: no]
    Anyone have any ideas how to work around it???

    This version deals with emptyText as a default color, and shows the color in the trigger. When I figure out the error above I'll post to the Wiki...

    Code:
    /**
     * @class Ext.ux.ColorField
     * @extends Ext.form.TriggerField
     * Provides a color input field with a {@link Ext.ColorPalette} dropdown.
    * @constructor
    * Create a new ColorField
     * <br />Example:
     * <pre><code>
    var color_field = new Ext.ux.ColorField({
    	fieldLabel: 'Color',
    	id: 'color',
    	width: 175,
    	allowBlank: false
    });
    </code></pre>
    * @param {Object} config
     */
    
    Ext.ux.ColorField = Ext.extend(Ext.form.TriggerField,  {
        /**
         * @cfg {String} invalidText
         * The error to display when the color in the field is invalid (defaults to
         * '{value} is not a valid color - it must be in the format {format}').
         */
        invalidText : "'{0}' is not a valid color - it must be in a the hex format (# followed by 3 or 6 letters/numbers 0-9 A-F)",
        /**
         * @cfg {String} triggerClass
         * An additional CSS class used to style the trigger button.  The trigger will always get the
         * class 'x-form-trigger' and triggerClass will be <b>appended</b> if specified (defaults to 'x-form-color-trigger'
         * which displays a color wheel icon).
         */
        triggerClass : 'x-form-color-trigger',
        /**
         * @cfg {String/Object} autoCreate
         * A DomHelper element spec, or true for a default element spec (defaults to
         * {tag: "input", type: "text", size: "10", autocomplete: "off"})
         */
    
        // private
        defaultAutoCreate : {tag: "input", type: "text", size: "10", maxlength: "7", autocomplete: "off"},
    
        // Limit input to hex values
    	maskRe: /[#a-f0-9]/i,
    	
        // private
        validateValue : function(value){
            if(!Ext.ux.ColorField.superclass.validateValue.call(this, value)){
                return false;
            }
            if(value.length < 1){ // if it's blank and textfield didn't flag it then it's valid
            	 this.setColor('');
            	 return true;
            }
    
            var parseOK = this.parseColor(value);
    
            if(!value || (parseOK == false)){
                this.markInvalid(String.format(this.invalidText,value));
                return false;
            }
    		this.setColor(value);
            return true;
        },
    
    	/**
    	 * Sets the current color and changes the background.
    	 * Does *not* change the value of the field.
    	 * @param {String} hex The color value.
    	 */
    	setColor : function(color) {
    		if (color=='' || color==undefined)
    		{
    			if (this.emptyText!='' && this.parseColor(this.emptyText))
    				color=this.emptyText;
    			else
    				color='transparent';
    		}
    		if (this.trigger)
    			this.trigger.setStyle( {
    				'background-color': color
    			});
    		else
    		{
    			this.on('render',function(){this.setColor(color)},this);
    		}
    	},
    	
        // private
        // Provides logic to override the default TriggerField.validateBlur which just returns true
        validateBlur : function(){
            return !this.menu || !this.menu.isVisible();
        },
    
        /**
         * Returns the current value of the color field
         * @return {String} value The color value
         */
        getValue : function(){
            return Ext.ux.ColorField.superclass.getValue.call(this) || "";
        },
    
        /**
         * Sets the value of the color field.  You can pass a string that can be parsed into a valid HTML color
         * <br />Usage:
         * <pre><code>
    		colorField.setValue('#FFFFFF');
           </code></pre>
         * @param {String} color The color string
         */
        setValue : function(color){
            Ext.ux.ColorField.superclass.setValue.call(this, this.formatColor(color));
    		this.setColor( this.formatColor(color));
        },
    
        // private
        parseColor : function(value){
    		return (!value || (value.substring(0,1) != '#')) ?
    			false : (value.length==4 || value.length==7 );
        },
    
        // private
        formatColor : function(value){
    		if (!value || this.parseColor(value))
    			return value;
    		if (value.length==3 || value.length==6) {
    			return '#' + value;
    		}
            return '';
        },
    
        // private
        menuListeners : {
            select: function(e, c){
                this.setValue(c);
            },
            show : function(){ // retain focus styling
                this.onFocus();
            },
            hide : function(){
                this.focus.defer(10, this);
                var ml = this.menuListeners;
                this.menu.un("select", ml.select,  this);
                this.menu.un("show", ml.show,  this);
                this.menu.un("hide", ml.hide,  this);
            }
        },
    
        // private
        // Implements the default empty TriggerField.onTriggerClick function to display the ColorPalette
        onTriggerClick : function(){
            if(this.disabled){
                return;
            }
            if(this.menu == null){
                this.menu = new Ext.menu.ColorMenu();
            }
    
            this.menu.on(Ext.apply({}, this.menuListeners, {
                scope:this
            }));
    
            this.menu.show(this.el, "tl-bl?");
        }
    });
    
    Ext.reg('colorfield',Ext.ux.ColorField);
    CSS:
    Code:
    .x-form-field-wrap .x-form-color-trigger {
    	background-image: url(/themes/common/ac/color-trigger.png);
    }
    
    .ie6 .x-form-field-wrap .x-form-color-trigger {
    	background-image: url(/themes/common/ac/color-trigger.gif);
    }
    Attached Images
    Attached Files

  6. #16
    Ext User stevefink's Avatar
    Join Date
    Aug 2007
    Posts
    117
    Vote Rating
    0
    stevefink is on a distinguished road

      0  

    Default


    Just curious... where in Ext's source should I be looking to figure out what exactly the following constructor is trying to do:

    Code:
    Ext.form.ColorField = function(config){
        Ext.form.ColorField.superclass.constructor.call(this, config);
    	this.on('render', this.handleRender);
    };
    I'd like to learn this code better, and I'm not entirely sure where the method on() is defined.

    Thanks!

  7. #17
    Ext User
    Join Date
    Nov 2007
    Posts
    12
    Vote Rating
    0
    ansh is on a distinguished road

      0  

    Default setColor() showing error

    setColor() showing error


    I am trying to change the colorfield value. But it is giving error inside setColor() like 'this.el has no properties'.

    Code:
    new Ext.form.ColorField({
    					fieldLabel: 'Color',					
    					id:'colpicker',					
    					showHexValue:true
    				}),
    ............................................
    
    Ext.getCmp('colpicker').setColor('FFFFFF') //error this.el has no properties
    Where i am wrong while changing the color through setColor function ?

  8. #18
    Ext User
    Join Date
    Nov 2007
    Posts
    12
    Vote Rating
    0
    ansh is on a distinguished road

      0  

    Default


    Sorry, please ignore the previous post. Actually i was calling the setColor() before the colorfield object render.

  9. #19
    Ext User amon's Avatar
    Join Date
    Apr 2007
    Location
    Budapest
    Posts
    109
    Vote Rating
    1
    amon is on a distinguished road

      0  

    Default


    Quote Originally Posted by stever View Post
    I'm having a problem where sometimes FireFox gives this sporatic error:
    Anyone have any ideas how to work around it???
    Yeah, set the autocomplete property of the form (or the input) to 'off'.

  10. #20
    Ext JS Premium Member stever's Avatar
    Join Date
    Mar 2007
    Posts
    1,406
    Vote Rating
    6
    stever will become famous soon enough stever will become famous soon enough

      0  

    Default


    It is off already...

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi