setColor properties doesn't work
Closed this issue · 3 comments
Hi, Thanks for this great project. I am using Ubuntu amd64 and finalcut as external library. But, I couldn't set colors of the widgets. Is there any active works on that? (I am sorry. I should have opened the tag with a question. But now i couldn't close this tag)
Hi Yusuf, the setColor() method is used to set the current print color. A widget consists of fixed colors defined in the widget color theme. These colors can usually redefined per widget object. Alternatively, you can change the colors in the widget color theme.
Example:
#include <final/final.h>
using namespace finalcut;
class Dialog : public FDialog
{
public:
explicit Dialog (FWidget* parent = nullptr)
: FDialog{parent}
{
button_widget.addCallback
(
"clicked",
getFApplication(),
&FApplication::cb_exitApp,
this
);
}
void draw() override
{
FDialog::draw();
// Change the print position (relative to the widget's origin)
setPrintPos({5, 4});
// Change the current print color
setColor (FColor::Yellow, FColor::Blue);
// Prints text at the current position in the current color
print(" yellow on blue ");
// Change the print position (relative to the widget's origin)
setPrintPos({6, 6});
// Change the current print color
setColor (FColor::White, FColor::Red);
// Prints text at the current position in the current color
print(" white on red ");
}
private:
void initLayout()
{
setText ("Colorful");
setGeometry (FPoint{28, 5}, FSize{24, 10});
FDialog::initLayout();
// Positions the button relative to the origin of
// the widget client area of this dialog widget
button_widget.setGeometry (FPoint{7, 6}, FSize{8, 1});
// Changes some widget button colors
button_widget.setFocusForegroundColor(FColor::White);
button_widget.setFocusBackgroundColor(FColor::Green);
}
FButton button_widget{"&Quit", this};
};
auto main (int argc, char* argv[]) -> int
{
FApplication app(argc, argv);
Dialog dialog(&app);
FWidget::setMainWidget(&dialog);
dialog.show();
return app.exec();
}Hi, Thank you very much for your detailed explanation.
I've added a new example widget-colors that shows the widget's internal predefined colors. I hope this helps to better understand how the widgets get their individual color.

