PureBasic Forum
https://www.purebasic.fr/english/

[Done] PB 5.50 / 5.51 TreeGadget with SetGadgetFont()
https://www.purebasic.fr/english/viewtopic.php?f=24&t=67364
Page 1 of 1

Author:  Christian [ Mon Jan 02, 2017 6:27 pm ]
Post subject:  [Done] PB 5.50 / 5.51 TreeGadget with SetGadgetFont()

Hi,

when using the TreeGadget with icons and a custom set font / font size I observed a small bug: the text is not correctly centered vertically with regard to the row height anymore. It's not a big thing, but it looks somehow ... ugly (see picture: left shows what PB produces, right how it should look like). (PB 5.51 x64 on macOS Sierra 10.12)


Here is a small example code:

Code:
EnableExplicit

Define WindowEvent.q

LoadFont(0, "Verdana", 12)

If OpenWindow(0, 0, 0, 200, 500, "TreeGadget", #PB_Window_ScreenCentered)
  TreeGadget(0, 10, 10, WindowWidth(0) - 20, WindowHeight(0) - 20)
    SetGadgetFont(0, FontID(0))
 
  CreateImage(0, 16, 16)

  If StartDrawing(ImageOutput(0))
    Box(0, 0, OutputWidth(), OutputHeight(), $CC3299)
    StopDrawing()
  EndIf

  CreateImage(1, 16, 16)

  If StartDrawing(ImageOutput(1))
    Box(0, 0, OutputWidth(), OutputHeight(), $7A96E9)
    StopDrawing()
  EndIf
 
  AddGadgetItem(0, -1, "Item", ImageID(0))
  AddGadgetItem(0, -1, "Subitem", ImageID(1), 1)
  SetGadgetItemState(0, 0, #PB_Tree_Expanded)

  Repeat
    WindowEvent = WaitWindowEvent()

    Select WindowEvent
    EndSelect
  Until WindowEvent = #PB_Event_CloseWindow
EndIf


Thanks and best regards,
Christian

Author:  Fred [ Thu Feb 13, 2020 7:39 am ]
Post subject:  Re: [PB 5.50 / 5.51] TreeGadget with SetGadgetFont()

Fixed.

Page 1 of 1 All times are UTC + 1 hour
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/