Jump to content
MikeZ87

How can I enlarge the font of a Combobox in Delphi FMX?

Recommended Posts

Hello,

 

I'm trying to create a combobox that I can style to look like this. I'd **LIKE** to do it solely in the WYSIWYG style designer. Can anyone point me to a tutorial on how even to change the font size in the Style designer? I'm admittedly such a noob in this, but I'm at a total loss.

 

Thanks.

 

- Mike

combobox.png

Share this post


Link to post

@MikeZ87

normally, you can do it using "Edit Custom Style" (right button on component), but in ComboBox, in fact, the items is a "ListBoxItems", and there is not a property to change it in StyleBook...

that way, you can just right-click on ComboBox, and select each item and change the property on Object Inspector, or by code like this:

    for var i: integer := 0 to (ComboBox1.Count - 1) do
    begin
    	ComboBox1.ListItems[i].StyledSettings := []; // remove parent styles...
    	ComboBox1.ListItems[i].Font.Size      := 28; // changing the properties...
    end;
  • exists a "delay" before show new setting...

Project1_kmoPkKcOxV.gif

Edited by programmerdelphi2k
  • Thanks 1

Share this post


Link to post

OMG!!! ProgrammerDelphi2K!!!! OMG!!! THANK YOU!!!!! That's EXACTLY what I was looking for. I knew about the listitems, but couldn't put 2 and 2 together to figure that out. THANK YOU SO MUCH!!!!!

 

It's working now! Much appreciated!

Share this post


Link to post

@MikeZ87

 

I found easy way to changes all "ITEMS" in ComboBox / ListBox using StyleBook setting/object - no needs code anymore!

  1. all that you need is
    1. open any "style file in your StyleBook", you can find in your Embarcadero Style folders in c:\users\Public folder
    2. now, find the object named "listboxitemstyle" and "COPY"
      1. this object will have all setting to change your "ITEMS", in ComboBox and/or ListBox together
    3. just close all go back to your project/form where is your "StyleBook" component
    4. double-click to open it
    5. now, just "PASTE" your new object (named "listboxitemstyle")
  2. now, do the changes...

 

bds_SrIObq2nrn.gif

Edited by programmerdelphi2k

Share this post


Link to post

That actually does make it A LOT easier. Thanks!

 

I was going to ask you - after playing with this a little bit, I notice that the main text (ie: the text of the itemindex item) is BIG (like the style,) but the drop-down text is still tiny. How can I change the font size of the drop down text?

 

Thanks again A MILLION!!!

 

- Mike

Share this post


Link to post

@MikeZ87

 

well, the "Styles" (old Skins, Themes, etc....) is a new way to put "color and actions" on GUI of apps, and honestly, it's a black box with too many ramifications to venture to master it!.. to understand a little more you needs use a StyleBook and testing each elements... 

you can "copy" all elements started with "listbox..." found in any Style like I said above... and search each "text" object and test it...

image.png.d2105d1a5aa3ec99d789ed7d65e91149.png

Edited by programmerdelphi2k

Share this post


Link to post

@MikeZ87

 

sometimes you need to do a little "hack" ... if possible... look,  StyleBook + Hacking class TComboListBox used by ComboBox in FMX

  • ListBox using ItemHeight = 100
  • ComboBox using (ListBox) ItemHeight = 60 + colors

 

bds_rDG1IdVXmQ.gif

  • Like 1

Share this post


Link to post
6 hours ago, MikeZ87 said:

That actually does make it A LOT easier. Thanks!

 

I was going to ask you - after playing with this a little bit, I notice that the main text (ie: the text of the itemindex item) is BIG (like the style,) but the drop-down text is still tiny. How can I change the font size of the drop down text?

 

Thanks again A MILLION!!!

 

- Mike

 

Have you tried changing the "Scale" property? in some cases it may be fine

Share this post


Link to post

Be aware that the editing structure of styles and their subcomponents were not necessarily compatible under all platforms. 

 

Which is the biggest headache in FMX styles IMHO.

Share this post


Link to post

Follow the suggestion from programmerdelphi2k,   I finally found all New Comboboxes or Listboxes will be got effect on new Text Size and Color settting in ListboxItemStyle.    It is global effect to all components that Listboxes associated with.     I try to rename listboxItemStyle to cboListboxItemStyle in Edit Custom Style and save,  then all comboboxes and Listboxes were reset to default no style applied to them.    So I try to apply the cboListboxItemStyle during runtime using this code but it has no effect.

 

  for var i: integer := 0 to (ComboBox1.Count - 1) do
  begin
    ComboBox1.ListItems[i].StyleLookup := 'cboListboxItemStyle';
  end;

So it seems combobox.listbox were fixed to ListboxItemStyle only.   It cannot be customized.       I need to know if there is a way to individually customize combobox and listbox.     

Edited by amit

Share this post


Link to post
7 hours ago, amit said:

 I need to know if it is a way to individually customize combobox and listbox.     

A "ComboBox" is a container to items = ListBoxItems, for that the styles is applyed on items, not necessary in the container!

try use Styles customizations on Combobox -> right-click on ComboBox and Edit Styles customs... and do the changes...

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×