How to set text size for the whole program (all gadgets) ?

Just starting out? Need help? Post your questions and find answers here.
vmars316
Enthusiast
Enthusiast
Posts: 474
Joined: Fri Jun 29, 2012 12:24 am
Contact:

How to set text size for the whole program (all gadgets) ?

Post by vmars316 »

Hello & Thanks ;
PureBasic 5.70 LTS (Windows - x86)
Clicking on:
Desktop Display Options
Scale and layout
Change the size of test, apps, and other items .
I sometimes run with 100% , sometimes with 125% .
But either way , the text size of gadgets (especially Buttons) ,
is too large .
How can I set text size for the whole program to Verdana , 12 ?
There are two windows .

Code: Select all

Procedure OpenWindow_0()  
    OpenWindow(Window_0, 0, 0, 448, 110, "BUTTONS-PIM pimLog.exe 3.0", #PB_Window_SystemMenu|#PB_Window_MinimizeGadget|#PB_Window_TitleBar) ;  | #PB_Window_SizeGadget) ; |#PB_Window_ScreenCentered)
    SetWindowColor(Window_0, RGB(192,192,192))
    SetWindowPos_(WindowID(Window_0),#HWND_TOPMOST,0,0,0,0,#SWP_NOMOVE|#SWP_NOSIZE)
    SetGadgetFont(Window_0,LoadFont(0,"Verdana",12)) 
;    LoadFont(1,"Arial",40) 
    sendToBtn = ButtonGadget(#PB_Any, 12, 20, 146, 28, "HIDE IN TASK_TRAY", #PB_Button_Default)
    findBtn = ButtonGadget(#PB_Any, 170, 20, 80, 28, "FIND", #PB_Button_Default)
    exitBtn = ButtonGadget(#PB_Any, 260, 20, 80, 28, "EXIT", #PB_Button_Default)
    helpBtn = ButtonGadget(#PB_Any, 350, 20, 80, 28, "HELP", #PB_Button_Default)
    restartBtn = ButtonGadget(#PB_Any, 12, 63, 146, 28, "RESTART pimLog", #PB_Button_Default)
    showTopicsCkBox = CheckBoxGadget(#PB_Any, 260, 63, 168, 30, "Prompt for Topic.", #PB_CheckBox_Center | #PB_Checkbox_Checked )  ; #PB_Checkbox_Unchecked)
    GadgetToolTip(showTopicsCkBox, "'Show Topic Buttons' POPUP for each COPY.  ELSE: FILE each Copy under MISC .")
EndProcedure ; OpenWindow_0()  
;
Procedure OpenWindow_1()
  Window_1_Xpos = (GetSystemMetrics_(#SM_CXSCREEN) - Window_1_Width) ; horizontal width.
  Window_1_Ypos = (GetSystemMetrics_(#SM_CYSCREEN) - Window_1_Height) ;  vertical height.
; LoadFont(#Font_Window_0_0,"Candara", 10)
  If OpenWindow(Window_1, Window_1_Xpos, 0, Window_1_Width, Window_1_Height, "Enter or Select Topic", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget| #PB_Window_TitleBar  | #PB_Window_SizeGadget)
    SetWindowColor(Window_1, RGB(192,192,192))
    SetWindowPos_(WindowID(Window_1),#HWND_TOPMOST,0,0,0,0,#SWP_NOMOVE|#SWP_NOSIZE)
    
  TopicContainer = ContainerGadget(#PB_Any, 12, 10, 222, 584)
    NewTopic = StringGadget(#PB_Any, 10, 9, 100, 24, " ")
    GadgetToolTip(NewTopic, "Enter TOPIC  or  Click Buttons below...")
    TopicsCkBox2 = CheckBoxGadget(#PB_Any, 114, 9, 100, 26, "Prompt for Topics", #PB_Checkbox_Checked)
    SetGadgetColor(TopicsCkBox2, #PB_Gadget_BackColor, $C0C0C0)
    GadgetToolTip(TopicsCkBox2, "'Show Topic Buttons' POPUP for each COPY.  ELSE: FILE each COPY under MISC .")
    CancelCopyBtn = ButtonGadget(#PB_Any, 10, 35, 100, 24, "CANCEL COPY", #PB_Button_Default)
    GadgetToolTip(CancelCopyBtn, "CANCEL  Current Copy Command .")
    EditListBtn = ButtonGadget(#PB_Any, 112, 35, 100, 24, "Edit Topic List", #PB_Button_Default)

Thanks
vmars.us Win11 x64 , Martin Guitar 000-16 (1995)
"All things in moderation , except for love and forgiveness."
User avatar
mk-soft
Always Here
Always Here
Posts: 5405
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: How to set text size for the whole program (all gadgets)

Post by mk-soft »

Before creating the gadgets set the font with SetGadgetFont(#PB_Default, ...)
ShowPB-Help...

or

Use Module ScaleGadgets
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Marc56us
Addict
Addict
Posts: 1479
Joined: Sat Feb 08, 2014 3:26 pm

Re: How to set text size for the whole program (all gadgets)

Post by Marc56us »

How can I set text size for the whole program to Verdana , 12 ?
As I create small graphical tools that have to use a fixed font, I often start my codes with these two lines.

Code: Select all

EnableExplicit

SetGadgetFont(#PB_Default, FontID(LoadFont(#PB_Any, "Consolas", 10)))
This is not valid for menus, file explorer and status bar. But for the rest it saves time.

:wink:
User avatar
mk-soft
Always Here
Always Here
Posts: 5405
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: How to set text size for the whole program (all gadgets)

Post by mk-soft »

I have not solved the same problem with my modules ScaleGadgets :(
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
wombats
Enthusiast
Enthusiast
Posts: 664
Joined: Thu Dec 29, 2011 5:03 pm

Re: How to set text size for the whole program (all gadgets)

Post by wombats »

I think you can change the font of ProGUI MenuEx menus.
vmars316
Enthusiast
Enthusiast
Posts: 474
Joined: Fri Jun 29, 2012 12:24 am
Contact:

Re: How to set text size for the whole program (all gadgets)

Post by vmars316 »

Marc56us wrote:
How can I set text size for the whole program to Verdana , 12 ?
As I create small graphical tools that have to use a fixed font, I often start my codes with these two lines.

Code: Select all

EnableExplicit

SetGadgetFont(#PB_Default, FontID(LoadFont(#PB_Any, "Consolas", 10)))
This is not valid for menus, file explorer and status bar. But for the rest it saves time.
:wink:
Thanks , that works fine :wink:
vmars.us Win11 x64 , Martin Guitar 000-16 (1995)
"All things in moderation , except for love and forgiveness."
Post Reply