Jump to content

How to set font for the list items in TUnimSelect?


likemike

Recommended Posts

Hello!

The "FieldlabelFont" works as expected, but the "Font"-property doesn't. The itemlist is always the same small size, even if I set the Font -> Size property to e.g. 20.

So the question is: How can I set font for the list items in TUnimSelect?

Thanks in advance and happy eastern

Mike

Link to comment
Share on other sites

Here is the working solution from Sherzod:

procedure TMainmForm.UnimFormCreate(Sender: TObject);
begin
  with UnimSelect1 do
  begin
    JSInterface.JSConfig('itemTpl', ['<span class="x-list-label" style="'+ Font.ToStyleString(True) +'; font-size: '+ (Font.Size+11).ToString() +'px">{val:htmlEncode}</span>']);
  end;
end;
Link to comment
Share on other sites

2 hours ago, likemike said:

Here is the working solution from Sherzod:

Also this solution:

with UnimSelect1 do
  begin
    //JSInterface.JSConfig('itemTpl', ['<span class="x-list-label" style="'+ Font.ToStyleString(True) +'; font-size: '+ (Font.Size+11).ToString() +'px">{val:htmlEncode}</span>']);
    JSInterface.JSConfig('itemTpl', ['<span class="x-list-label" style="'+ Font.ToStyleString(True, False, True) +'">{val:htmlEncode}</span>']);
  end;

 

Link to comment
Share on other sites

  • 8 months later...
On 4/3/2021 at 4:53 PM, Sherzod said:
JSInterface.JSConfig('itemTpl', ['<span class="x-list-label" style="'+ Font.ToStyleString(True, False, True) +'">{val:htmlEncode}</span>']);

 

Tell me, where is the font size set here?

Link to comment
Share on other sites

I understand

 

procedure SetFontunimSelect(sel: TunimSelect; iSize: integer; WordWrap: Boolean);
begin
// размер шрифта для выпадающего списка unimSelect
  sel.JSInterface.JSConfig('itemTpl', ['<span class="x-list-label" style="' +
    sel.Font.ToStyleString(True, False, True) +
    '; font-size: ' + iSize.ToString + 'px; ' +
    ifthen(WordWrap, 'word-break: break-all', '') +
    '">{val:htmlEncode}</span>']);

end;

 

Link to comment
Share on other sites

×
×
  • Create New...