Jump to content

Problem with TUniComboBox, with Property: Font


Angelica

Recommended Posts

1 hour ago, Angelica said:

I've made  a simple testcase and I attached it.

Thanks for the testcase.

Maybe one possible solution for now, can you try ?

Uses ..., ExtPascalUtils;

procedure TMainForm.UniFormCreate(Sender: TObject);
begin
  with UniComboBox1 do
    ClientEvents.UniEvents.Values['beforeInit'] :=
      'function beforeInit(sender, config) {'+
      '    config.listConfig = {'+
      '        tpl: new Ext.XTemplate('+
      '            ''<tpl for="."><div class="x-boundlist-item" style="'+ Font.ToStyleString(True) +'">{val}</div></tpl>'', {'+
      '                disableFormats: true'+
      '            }'+
      '        )'+
      '    };'+
      '}';
end;

 

Link to comment
Share on other sites

  • Sherzod changed the title to Problem with TUniComboBox, with Property: Font
  • 1 year later...

Thank you, 

That finally also worked for me ...

Kattes

procedure TMainForm.UniFormCreate(Sender: TObject);

  procedure AdjustDropDownFont(CB: tUniComboBox);
  begin    // Only works if ItemIndex=0 is or if UniComboBox Style is csSimple ???
    with CB do
      ClientEvents.UniEvents.Values['beforeInit'] :=
        'function beforeInit(sender, config) {'+
        '    config.listConfig = {'+
        '        tpl: new Ext.XTemplate('+
        '            ''<tpl for="."><div class="x-boundlist-item" style="'+ Font.ToStyleString(True) +'">{val}</div></tpl>'', {'+
        '                disableFormats: true'+
        '            }'+
        '        )'+
        '    };'+
        '}';
  end;

begin
  AdjustDropDownFont(UniComboBoxZahlart);
  AdjustDropDownFont(UniComboBoxPrintTicket);
end;

 

 

Link to comment
Share on other sites

  • 11 months later...
Em 23/6/2020 às 7:37 am, Kattes disse:

Obrigado

Que finalmente também funcionou para mim...

Kattes


procedure TMainForm.UniFormCreate(Sender: TObject);

  procedure AdjustDropDownFont(CB: tUniComboBox);
  begin    // Only works if ItemIndex=0 is or if UniComboBox Style is csSimple ???
    with CB do
      ClientEvents.UniEvents.Values['beforeInit'] :=
        'function beforeInit(sender, config) {'+
        '    config.listConfig = {'+
        '        tpl: new Ext.XTemplate('+
        '            ''<tpl for="."><div class="x-boundlist-item" style="'+ Font.ToStyleString(True) +'">{val}</div></tpl>'', {'+
        '                disableFormats: true'+
        '            }'+
        '        )'+
        '    };'+
        '}';
  end;

begin
  AdjustDropDownFont(UniComboBoxZahlart);
  AdjustDropDownFont(UniComboBoxPrintTicket);
end;

 

 

Hello, would it be possible to create one to define the font color? example: if Text.Constain ('Inactive') then color: = red;

Link to comment
Share on other sites

8 hours ago, picyka said:

Hello, would it be possible to create one to define the font color? example: if Text.Constain ('Inactive') then color: = red;

Hello,

Try this code:

procedure TMainForm.UniFormCreate(Sender: TObject);
begin
  with UniComboBox1 do
    ClientEvents.UniEvents.Values['beforeInit'] :=
      'function beforeInit(sender, config) {'+
      '    config.listConfig = {'+
      '        tpl: new Ext.XTemplate('+
      '            ''<tpl for="."><div class="x-boundlist-item" style="{[this.check(values)]}">{val}</div></tpl>'', {'+
      '                disableFormats: true,'+
      '                check: function(values) {'+
      '                    if (values["val"] !== "Inactive") {return "'+ Font.ToStyleString(True) +'"} else {return "'+ Font.ToStyleString(True) +'; color: red;"}'+
      '                }'+
      '            }'+
      '        )'+
      '    }'+
      '}';
end;

 

Link to comment
Share on other sites

  • 2 years later...
On 5/28/2021 at 12:56 PM, Sherzod said:

Hello,

Try this code:

procedure TMainForm.UniFormCreate(Sender: TObject);
begin
  with UniComboBox1 do
    ClientEvents.UniEvents.Values['beforeInit'] :=
      'function beforeInit(sender, config) {'+
      '    config.listConfig = {'+
      '        tpl: new Ext.XTemplate('+
      '            ''<tpl for="."><div class="x-boundlist-item" style="{[this.check(values)]}">{val}</div></tpl>'', {'+
      '                disableFormats: true,'+
      '                check: function(values) {'+
      '                    if (values["val"] !== "Inactive") {return "'+ Font.ToStyleString(True) +'"} else {return "'+ Font.ToStyleString(True) +'; color: red;"}'+
      '                }'+
      '            }'+
      '        )'+
      '    }'+
      '}';
end;

 

TunimComboBox do not work.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...