Jump to content


Photo

Colorpicker in Grid


  • Please log in to reply
4 replies to this topic

#1 ice

ice

    Active Member

  • uniGUI Subscriber
  • PipPipPip
  • 67 posts

Posted 12 February 2018 - 07:44 PM

How can use a colorpicker in UniDBGrid like ComboBox.


  • 0

#2 Delphi Developer

Delphi Developer

    Advanced Member

  • Moderators
  • 4559 posts

Posted 12 February 2018 - 08:39 PM

Hi,

 

Maybe this post can help you:

 

http://forums.unigui...id-color-combo/

 

Best regards,


  • 0

#3 ice

ice

    Active Member

  • uniGUI Subscriber
  • PipPipPip
  • 67 posts

Posted 12 February 2018 - 09:01 PM

Thanks,

but i can't find change and focus in UniComboBox1 -> ClientEvents -> ExtEvents 

 

UniGui Ver: 1.0.2.1434


  • 0

#4 Delphi Developer

Delphi Developer

    Advanced Member

  • Moderators
  • 4559 posts

Posted 13 February 2018 - 03:56 AM

Hi,

Ok, I will check
  • 0

#5 Delphi Developer

Delphi Developer

    Advanced Member

  • Moderators
  • 4559 posts

Posted 13 February 2018 - 04:05 PM

Hi,

 

Thanks,

but i can't find change and focus in UniComboBox1 -> ClientEvents -> ExtEvents 

 

UniGui Ver: 1.0.2.1434

 

You can try to add these events in function afterCreate:

function afterCreate(sender)
{
    sender.addListener(
        'change',
        function(sender, newValue, oldValue, eOpts) {
            var element = sender;
            var inputEl = element.inputCell.child('input');
            var data = element.getStore().findRecord(element.valueField, newValue);

            if (data) {
                inputEl.applyStyles('padding-left:42px');
                var parent = inputEl.parent(),
                    spanDomEle = parent.child('span');

                if (!spanDomEle) {
                    Ext.DomHelper.insertFirst(parent, {
                        tag: 'span',
                        html: '        '
                    });
                    var newSpanDomEle = parent.child('span');
                    newSpanDomEle.applyStyles('background-color: ' + getHexa(data.get(element.displayField)) + ';float: left; position: absolute; top: 0.9px; margin: 3px 2px 2px 4px; width: 33px; height: 15px;');
                } else {
                    spanDomEle.applyStyles('background-color:' + getHexa(data.get(element.displayField)));
                }
            }
        }
    );

    sender.addListener(
        'focus',
        function(sender, e, eOpts) {
            var parent = sender.inputCell.child('input').parent(),
                spanDomEle = parent.child('span');

            if (spanDomEle) {
                spanDomEle.applyStyles('background-color:' + getHexa(sender.value));
            }
        }
    );
}

  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users