Board index » kylix » How to change the Font on the Main Menu

How to change the Font on the Main Menu


2005-08-18 03:34:45 AM
kylix1
Ok using Kylix 3 on Red Hat (release9)
Is there a way to change the Font for the menu components in
Kylix? The menus(both pop-up and main) have no Font property. I can try to set a Font at the Application Level and the
ParentFont property equal to true for the form, which according
to the help, makes all controls on the form use the ParentFont.
In my testing setting the Font at the application level appears
to have no effect on the size of the fonts in the Menu.
Any suggestions?
I normally would not do this, as it is a users choice to set their fonts a particular way, but for this specific
application, it would be a perfect solution.
 
 

Re:How to change the Font on the Main Menu

For me, the following works: (I have no idea why ;-)
In the Project file (*.dpr) set the application font before "initialize"
...
Application.Font.Name:='helvetica';
Application.Font.Height:=18;
Application.Initialize;
...
and then in the main form:
procedure TForm1.FormCreate(Sender: TObject);
begin
Font.assign(application.font);
ParentFont := true;
...
 

Re:How to change the Font on the Main Menu

Jim wrote:
Quote

Ok using Kylix 3 on Red Hat (release9)

Is there a way to change the Font for the menu components in
Kylix? The menus(both pop-up and main) have no Font property. I can try to
set a Font at the Application Level and the ParentFont property equal to
true for the form, which according to the help, makes all controls on the
form use the ParentFont.
this works ok...
var
F: TFont;
begin
f := TFont.Create;
f.Size := 100;
f.Name := 'Arial';
[...]
QPopupMenu_setFont(PopupMenu1.Handle,f.Handle);
[...]
 

{smallsort}

Re:How to change the Font on the Main Menu

zeljko < XXXX@XXXXX.COM >wrote:
Quote
this works ok...

var
F: TFont;

begin
f := TFont.Create;
f.Size := 100;
f.Name := 'Arial';
[...]
QPopupMenu_setFont(PopupMenu1.Handle,f.Handle);
[...]


This works nicely for popup menus but I couldn't find a QMenu
(QMenuBar, QMenuItem or QMenuData) that had a setFont function.
I went digging a little deeper and I found
QWidget_setFont(MainMenu1.Handle, Font.Handle);
works as I had hoped. Thanks for the suggestion.
 

Re:How to change the Font on the Main Menu

This is essentially what I was doing and it didn't work at all
for me. Thanks for the prompt response though :)
I found QWidget_setFont does just what I need.
theo < XXXX@XXXXX.COM >wrote:
Quote
For me, the following works: (I have no idea why ;-)

In the Project file (*.dpr) set the application font before "initialize"

...
Application.Font.Name:='helvetica';
Application.Font.Height:=18;
Application.Initialize;
...

and then in the main form:


procedure TForm1.FormCreate(Sender: TObject);
begin
Font.assign(application.font);
ParentFont := true;
...

 

Re:How to change the Font on the Main Menu

Quote
QWidget_setFont(MainMenu1.Handle, Font.Handle);
yes, I've forgotten to copy-paste this part about main menu :)