TreeGadget Font & Color

Just starting out? Need help? Post your questions and find answers here.
munfraid
Posts: 135
Joined: Sat Mar 24, 2018 1:33 pm

TreeGadget Font & Color

Post by munfraid »

Hi everybody,

I need a custom navigation gadget an figured out, that the TreeGadget would be great for this, but there are some problems.
  • Custom fonts work, but line spacing seems fixed (see example). Is there a way to change line spacing with big fonts?
  • Custom Color works just for the entire gadget. Is it possible to set color just for a gadget item?
  • Is it possible to change the navigation symbols (">")?

Code: Select all

OpenWindow(0, 0, 0, 600, 400, "Treegadget Font Problem", #PB_Window_ScreenCentered)

TreeGadget(0, 10, 10, 280, 380)
AddGadgetItem(0, -1, "Treegadget")
AddGadgetItem(0, -1, "with default font")


TreeGadget(1, 310, 10, 280, 380)
AddGadgetItem(1, -1, "Treegadget")
AddGadgetItem(1, -1, "with custom font")

LoadFont(0, "Arial", 30)  
SetGadgetFont(1, FontID(0))
AZJIO
Posts: 76
Joined: Wed Dec 14, 2022 1:13 pm

Re: TreeGadget Font & Color

Post by AZJIO »

munfraid wrote: Mon Feb 19, 2024 3:43 pm Custom fonts work, but line spacing seems fixed (see example). Is there a way to change line spacing with big fonts?
Non-standard solution - many things can be solved by customizing the theme. In the compiler settings ("Compiler options") you can select a theme. Initially there are two themes, but you can make a copy of the file and rename it, then you will have three themes. But it is better to make several themes individually for a specific program, since the theme will not be universal, but will have its own characteristics. If you immediately make a ready-made theme, it may not be ideal for another program and you will have to do double work, so I suggest making several themes, and then decide whether your theme is universal. For example, having changed the width of an element, in the future you will need to restore the normal width and look for all the changes that interfered with the new program.
viewtopic.php?t=2445
Image
munfraid wrote: Mon Feb 19, 2024 3:43 pm Custom Color works just for the entire gadget. Is it possible to set color just for a gadget item?
I looked for the same feature for the ListViewGadget() function and didn't find it. You can use tags for menu items

Code: Select all

MenuItem(1, "with <font color=#FF9999>custom</font>  font")
But for AddGadgetItem() it doesn't work.
munfraid
Posts: 135
Joined: Sat Mar 24, 2018 1:33 pm

Re: TreeGadget Font & Color

Post by munfraid »

Having your own theme for each project is a really cool idea! Doing this you can modify the css as you need. Will start testing this out soon!

Thank you very much for this great tipp!
Post Reply