Page 1 of 1

Why can not change the text color in the tooltip ?

Posted: Wed Jul 19, 2017 00:59
by 0xaa55
Hi,
I added some code in cegui-0.8.7\samples\DragDropDemo\Sample_DragDropDemo.cpp : bool DragDropDemo::initialise(CEGUI::GUIContext* guiContext)

Code: Select all

bool DragDropDemo::initialise(CEGUI::GUIContext* guiContext)
{
    using namespace CEGUI;

    d_guiContext = guiContext;
    d_usedFiles = CEGUI::String(__FILE__);

    // load windows look
    SchemeManager::getSingleton().createFromFile("WindowsLook.scheme");

    // load font and setup default if not loaded via scheme
    Font& defaultFont = FontManager::getSingleton().createFromFile("DejaVuSans-12.font");
    // Set default font for the gui context
    guiContext->setDefaultFont(&defaultFont);

    // set up defaults
    guiContext->getMouseCursor().setDefaultImage("WindowsLook/MouseArrow");

   //
   guiContext->setDefaultTooltipType("WindowsLook/Tooltip");


    // load the drive icons imageset
    ImageManager::getSingleton().loadImageset("DriveIcons.imageset");

    // load the initial layout
    guiContext->setRootWindow(
        WindowManager::getSingleton().loadLayoutFromFile("DragDropDemo.layout"));

    //Here is the code I added
    //****************************************************************************************************
   Window* DragContainer2 = d_guiContext->getRootWindow()->getChild("MainWindow/Slot6/DragContainer2");
   
   std::stringstream ssTooltip;
   ssTooltip
      << "[colour='FF0000FF']" << "axe" << std::endl
      << "------------------------" << std::endl
      << "[top-padding='0'][bottom-padding='0'][colour='FF00FFFF']" << "This is a very sharp ax." << std::endl
      << "------------------------" << std::endl
      << "Tech Level: " << "123" << std::endl
      << "------------------------" << std::endl;

      DragContainer2->setTooltipText(ssTooltip.str());
    //****************************************************************************************************   

    // setup events
    subscribeEvents();

    // success!
    return true;
}


Image
All the text does not change the color.
What should I do?

Re: Why can not change the text color in the tooltip ?

Posted: Thu Aug 17, 2017 19:56
by Ident
Just change the style of the tooltip to whatever you want. The tooltip has a look n' feel. You can edit it to be whatever you want there. Try to look at other look n' feels to get ideas of how to change colours etc.

Re: Why can not change the text color in the tooltip ?

Posted: Fri Oct 13, 2017 01:05
by 0xaa55
Ident wrote:Just change the style of the tooltip to whatever you want. The tooltip has a look n' feel. You can edit it to be whatever you want there. Try to look at other look n' feels to get ideas of how to change colours etc.


Thank you.