Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong stripe color of elements inside folder with custom theme. #36

Closed
rvega opened this issue Jan 17, 2016 · 6 comments
Closed

Wrong stripe color of elements inside folder with custom theme. #36

rvega opened this issue Jan 17, 2016 · 6 comments
Labels

Comments

@rvega
Copy link

rvega commented Jan 17, 2016

I created a custom theme that only changes width and font size:

class AppGuiTheme: public ofxDatGuiTheme{
  public:
    AppGuiTheme(){
      font.size = 8;
      layout.width = 300;
      init();
    }
};

Then I created a gui, applied the theme (gui->setTheme(new AppGuiTheme())), added two folders (gui->addFolder()) and some elements within the folders (f1->addButton()).

The elements within the folders end up with the default theme stripe color instead of the color for the folder. The expected behavior is that the elements have the folder's color.

If I remove the gui->setTheme() statement, the default theme is used and the elements within the folders correctly render with the folder's color.

@braitsch
Copy link
Owner

Apply the theme after adding all the components to the folder. Individual components (folders, buttons, etc) do not store a reference to any applied themes like a gui does. This may change in the future but for now you'll have to apply the theme after constructing the folder.

@rvega
Copy link
Author

rvega commented Jan 17, 2016

Thanks for the reply :)

It still does not work after doing that. Here's my code and a screenshot of the rendered GUI.

  ofxDatGui* gui = new ofxDatGui(ofxDatGuiAnchor::TOP_LEFT);

  ofColor yellow = ofColor::fromHex(0xFFD00B);
  ofxDatGuiFolder* f1 = gui->addFolder("DSP PARAMETERS", yellow);
  f1->addSlider("  Slider", 0, 1);
  f1->addButton("  Button");
  f1->addBreak();
  f1->expand();

  ofColor green = ofColor::fromHex(0x1ED36F);
  ofxDatGuiFolder* f2 = gui->addFolder("TEXT OUTPUT", green);
  f2->addButton("  Copy");
  f2->addButton("  Clear");
  f2->expand();

  gui->setTheme(new AppGuiTheme());

  f1->onButtonEvent(this, &GUI::clickedButton);
  f1->onSliderEvent(this, &GUI::changedSlider);
  f2->onButtonEvent(this, &GUI::clickedButton);
  f2->onSliderEvent(this, &GUI::changedSlider);

All of that is within the setup() method

screenshot-2016-01-17-21 47 47

@braitsch
Copy link
Owner

Hi, I just copied and pasted your code into a new project, applied one of the stock themes and this is what I'm seeing.

ofxDatGui* gui = new ofxDatGui(ofxDatGuiAnchor::TOP_LEFT);

ofColor yellow = ofColor::fromHex(0xFFD00B);
ofxDatGuiFolder* f1 = gui->addFolder("DSP PARAMETERS", yellow);
f1->addSlider("  Slider", 0, 1);
f1->addButton("  Button");
f1->addBreak();
f1->expand();

ofColor green = ofColor::fromHex(0x1ED36F);
ofxDatGuiFolder* f2 = gui->addFolder("TEXT OUTPUT", green);
f2->addButton("  Copy");
f2->addButton("  Clear");
f2->expand();

gui->setTheme(new ofxDatGuiThemeCharcoal());

f1->onButtonEvent(this, &ofApp::clickedButton);
f1->onSliderEvent(this, &ofApp::changedSlider);
f2->onButtonEvent(this, &ofApp::clickedButton);
f2->onSliderEvent(this, &ofApp::changedSlider);

screen shot 2016-01-22 at 2 56 27 pm

Are you using the latest on master?

@braitsch
Copy link
Owner

Closing as I'm not able to reproduce the issue. Feel free to reopen if you can provide more information.

@rvega
Copy link
Author

rvega commented Jan 24, 2016

May I ask which theme you applied? I saw that all of them, except the default one hide the stripe, so the issue would not be visible. Also, note that I'm applying a custom theme.

Maybe this is a feature, not a bug. Let's see: When you are using the default theme, are the elements within a folder supposed to "inherit" the stripe color from the folder? If so, then this is a bug. If not, it's expected behavior.

To reproduce, create and apply a custom theme by inheriting and overriding some properties from the default theme (not the stripe color). The posted example is exactly what I'm describing.

@braitsch
Copy link
Owner

Hi, sorry this is a bug. I didn't at first realize what you were describing but I see now what you mean. I just pushed up a patch that should resolve this. 64d7f79 Let me know if this resolves the issue.

@braitsch braitsch reopened this Jan 26, 2016
@braitsch braitsch added the bug label Jan 26, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants