Main Menu

Close button

Started by CatalinNic, 06 October 2019, 17:18:03


I don't know how to modify the close button of a ChildWindow, cam someone help me?


How exactly do you want modify it?


Change the colors or set a texture


Not sure about texture, but here code for changing color(from tests):

            tgui::ButtonRenderer closeButtonRenderer;
            ptr->getRenderer()->setCloseButton(closeButtonRenderer.getData());//ptr is pointer to your child window


Now i try to use themes but when I read them my program crashes with:
terminate called after throwing an instance of 'tgui::Exception'
  what():  Error while parsing input at line 19. Found '=' while trying to read a value.
and the theme file is:
Code (ini) Select

Button {
    BackgroundColor = rgb(47, 52, 63);
    BackgroundColorHover = rgb(67, 72, 83);
    TextColor = rgb(187, 196, 202);
    TextColorHover = rgb(187, 196, 202);
    BorderColor = rgb(0, 0, 0);

ChildWindow {
    TitleColor = rgb(187, 196, 202);
    TitleBarColor = rgb(47, 52, 63);
    BackgroundColor = rgb(51, 51, 51);
    BorderColor = rgb(0, 0, 0);
    DistanceToSide = 3;
    PaddingBetweenButtons = 1;
    ShowTextOnTitleButtons = true
    CloseButton = &Button;
    MaximizeButton = &Button;
    MinimizeButton = &Button;


I've never used own themes so I've no idea why your code crashed, but in standard theme them defined separately. What if you also do so?
In any case better provide sample for reproducing the behavior.


It gives the exception because you are missing a semi-colon behind "ShowTextOnTitleButtons = true".
The parser sees "true CloseButton=&Button" as the value of ShowTextOnTitleButtons, which it considers invalid since it contains an unquoted '=' sign.