assigning FONT in richedit

Whats wrong with my code why my richedit will not change its font when it comes with Wingdings and Marlett etc.. := FontName.items[FontName.itemindex];

where [fontName] contains LIST OF FONT NAMES like

Arial Black
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

girlswants_meAuthor Commented:
can you give me the exact code for it?
thank you in advance
Mohammed NasmanSoftware DeveloperCommented:

  use SelAttributes instead of Font to change the font of selected Text

  RichEdit1.SelAttributes.Name := FontName.Items[FontName.ItemIndex];

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
a guess

this line := FontName.items[FontName.itemindex];
changes only the defaultattributes

if you want to change the font you must first select the whole text and apply your font to the selattributes like

richedit1.selstart := 0;
richedit1.sellength := length(Richedit1.lines.text);
//maybe there is a richedit.selectall; := FontName.items[FontName.itemindex];

just from head, not tested

meikl ;-)
Amazon Web Services

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

girlswants_meAuthor Commented:
it still dont work
is the font available on the system?
Try this:

procedure TForm1.FormCreate(Sender: TObject);

procedure TForm1.Button1Click(Sender: TObject);
 RIchEdit1.Text:='DrDelphi rules';

procedure TForm1.Button2Click(Sender: TObject);


This works for me here, with every font that appears in the listbox. Good luck!!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Fonts Typography

From novice to tech pro — start learning today.