[CLOSED] Colorfield ?

  1. #1

    [CLOSED] Colorfield ?

    Hi,

    It would be nice to have a 'colorfield' like a datefield. So, when clicking in the field, a color palette pops up on which you can choose a color. The value of the color choosen, would be inserted in the field. Very handy in (for example) a property grid. (see attachement)

    Maybe something exist already, but couldn't find an example.

    Just a thought,

    Martin
    Attached Thumbnails Click image for larger version. 

Name:	colorpicker.png 
Views:	82 
Size:	15.9 KB 
ID:	2862  
    Last edited by Daniil; Jun 16, 2011 at 8:04 AM. Reason: [CLOSED]
  2. #2
    Hi Martin,

    Please use DropDownField.
    http://forums.ext.net/showthread.php?9320

    Example
    <%@ Page Language="C#" %>
    
    <%@ Import Namespace="System.Collections.Generic" %>
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>Ext.NET Example</title>
        
        <style type="text/css">
            .no-image {
                background-image: none;
            }
        </style>
    
        <script type="text/javascript">
            var selectColor = function(cp, color) {
                DropDownField1.setValue("#" + color);
                DropDownField1.el.applyStyles("background-color:" + "#" + color + ";");
            }
        </script>
    
    </head>
    <body>
        <ext:ResourceManager runat="server" />
        <ext:DropDownField 
            ID="DropDownField1" 
            runat="server" 
            Editable="false" 
            Cls="no-image">
            <Component>
                <ext:Panel runat="server" AutoWidth="true" AutoHeight="true">
                    <Items>
                        <ext:ColorPalette runat="server">
                            <Listeners>
                                <Select Fn="selectColor" />
                            </Listeners>
                        </ext:ColorPalette>
                    </Items>
                </ext:Panel>
            </Component>
        </ext:DropDownField>
    </body>
    </html>
  3. #3
    Thanks Daniil. That looks good !

    Martin

Similar Threads

  1. [CLOSED] Colorfield in Propertygrid. Allow empty
    By CarWise in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Jun 20, 2011, 11:56 AM

Posting Permissions