Code Monkey home page Code Monkey logo

ofxui's Introduction

OFXUI IS DEPRECATED, USE OFXGUI (BUILT INTO OF) THIS ADDON IS NO LONGER SUPPORTED

ofxUI

A User Interface Library/Addon for openFrameworks

ofxUI is an addon for openFrameworks (version 0.9.0+) that easily allows for the creation of user interfaces aka GUIs. ofxUI also takes care of widget layout, spacing, font loading, saving and loading settings, and widget callbacks. ofxUI can be easily customized (colors, font & widget sizes, padding, layout, etc).

Featured Projects: http://www.syedrezaali.com/#/ofxui-project-showcase/

ofxUI contains a collection of minimally designed graphical user interface (GUI) widgets including:

  • Buttons (push, state, toggle, image, label)
  • Button Matrices
  • Dropdown Menus
  • Labels
  • Sliders (rotary, range, vertical, horizontal)
  • Number Dials
  • 2D Pads
  • Text Input Areas
  • Base Draws (ofImages, ofTexture, ofFbo, etc)
  • Image Sliders
  • Image Buttons
  • Image Color Sampler
  • Value Plotters
  • Moving Graphs
  • Waveform & Spectrum Graphs
  • Radio Toggles
  • Text Areas
  • Sortable List

This library allows for rapid UI design and development. It uses ofTrueTypeFonts for nice font rendering. Widget layout is semi-automatic, and can be easily customized. ofxUI is a GL based GUI and uses openFramework's drawings calls to render its widgets. It integrates into openFrameworks projects very easily since it was designed specifically for OF. There are many examples included in the download that show how to add widgets, customize their placement, get values from different types of widgets, set widget values, add callback functions for gui events, saving and loading settings, and more.

This UI library was inspired & influenced by:

It has been tested on OSX and iOS (OF 073+). It should work on linux and windows, since its only dependency is openFrameworks & ofxXmlSettings. ofxUI is open source under an MIT License, therefore you can use it in commercial and non-commercial projects. If you do end up using it, please let me know. I would love to see more examples of it out there in the wild. If you plan to use it in a commercial project please consider donating to help support this addon and future releases/fixes/features (http://www.syedrezaali.com/blog/?p=2172).

In terms of performance, I haven't compared it to other GUIs out there, but since its written using OF drawing calls and uses Listeners built in to OF, it run very fast and doesn't take a lot of CPU cycles...atleast when I tested it when my sketches. On my laptop (Apple Macbook Pro 2009) without vertical sync the all widgets example runs upwards of ~350 fps.

On a personal note: I designed ofxUI so that if I present my work to a client or put out an App on the App store, it would have a decent aesthetic and be presentable to non-hackers/programmers. I really like the widgets in MaxMsp, so I wanted to have something similar so when I prototype in C++ I could easily go about creating a UI that is pleasing to use and works robustly.

Additionally, I was motived to write my own since I wanted something like ControlP5 (which is easy to get up and running) for Processing for OF. I use ControlP5 a lot and love its minimal aesthetic. I also love simpleGUI for Cinder, but since I primarily code using OF, I developed ofxUI with the intentions that it needs to be minimally designed, intuitive to use, easily integrated, flexible and customizable.

When I first started programming with C++ it was difficult for me to use the other GUIs...their either depended on other libraries, which weren't included in the download, and it wouldn't work out of the box, or they were complicated to integrate into my projects. Additionally, I was motived to write my own since I wanted something like ControlP5 (which is easy to get up and running) for Processing for OF. I use ControlP5 a lot and love its minimal aesthetic. I also love simpleGUI for Cinder, but since I primarily code using OF, I developed ofxUI with the intentions that it needs to be minimally designed, intuitive to use, easily integrated, flexible and customizable.

Requirements

  • openFrameworks 0.9.0+

Getting Started

This tutorial will provide step by step instructions on how to get started with ofxUI. For this we are going to be assuming you are using openFrameworks 0.8.0+ for OSX, however these instructions should be easily adaptable for iOS.

  • After downloading or cloning ofxUI, place it in your openframeworks addons folder.

  • Create a new openframeworks project using the project generator, make sure ofxUI and ofxXmlSettings are enabled from the list of addons shown.

  • Open the project in xCode.

  • Now select your ofApp.h file and add #include "ofxUI.h" under #include "ofMain.h"

  • Then in your ofApp.h file, create a new ofxUICanvas object within the ofApp class like so:

ofxUISuperCanvas *gui;

In addition create two functions:

void exit(); 
void guiEvent(ofxUIEventArgs &e);
  • Switch over to your ofApp.cpp file and define the exit and guiEvent functions:
void ofApp::exit()
{
	
}

void ofApp::guiEvent(ofxUIEventArgs &e)
{
	
}
  • Within the setup function we are going to initialize the gui object and add widgets to it. So one way to do that is:
gui = new ofxUISuperCanvas("OFXUI TUTORIAL");		//Creates a canvas at (0,0) using the default width	
  • In the exit function we have to delete the gui after we are done using the application. But before this we want to tell the GUI to save the current values in the widgets to an XML file. Thus your exit function should look like:
void ofApp::exit()
{
    gui->saveSettings("settings.xml");     
    delete gui; 
}
  • We are now going to:

    • add a slider widget to the GUI
    • automatically size the gui to fit all the widgets
    • add an event listener to the ofApp
    • load settings from an xml file called settings.xml
gui->addSlider("BACKGROUND",0.0,255.0,100.0); 
gui->autoSizeToFitWidgets(); 
ofAddListener(gui->newGUIEvent, this, &ofApp::guiEvent); 
gui->loadSettings("settings.xml");

Note: The second to last line adds a listener/callback, so the gui knows what function to call once a widget is triggered or interacted with by the user, don't worry if its doesn't make too much sense right now, you'll get the hang of it. The last line tells the gui to load settings (widget values from a saved xml file, if the file isn't present it uses the default value of the widgets).

  • Now to the guiEvent function, we need to react to the user input. The argument of the guiEvent function, ofxUIEventArgs &e, contains the widget which was modified. To access the widget we do the following:
void testApp::guiEvent(ofxUIEventArgs &e)
{
    if(e.getName() == "BACKGROUND")	
    {
        ofxUISlider *slider = e.getSlider();    
        ofBackground(slider->getScaledValue());
    }   
}

Note: The if statement compares the widget's name with "BACKGROUND". It does that via a string comparison. If the widget's name is "BACKGROUND", then its the slider widget we created earlier. The slider's value is retrieved by the getScaledValue() function.

  • Lets add a toggle to toggle the window between fullscreen and window mode. In the setup function add another widget after the slider widget:
gui->addToggle("FULLSCREEN", false);
  • We have to now respond to the "FULLSCREEN" toggle widget so we add more functionality to our guiEvent function. In the end it should look like:
void testApp::guiEvent(ofxUIEventArgs &e)
{
    if(e.getName() == "BACKGROUND")
    {
        ofxUISlider *slider = e.getSlider();    
        ofBackground(slider->getScaledValue());
    }
    else if(e.getName() == "FULLSCREEN")
    {
        ofxUIToggle *toggle = e.getToggle(); 
        ofSetFullscreen(toggle->getValue()); 
    }    
}

Note: So you can see adding other kinds of widgets and reacting to them are done in a very similar manner. Explore the examples to check out how to access some of the more complex widgets and variable binding so callbacks are needed as often. I hope you'll see thats its pretty intuitive. I tried my best to limit the amount of code that needs to be written, however I kept it open enough so people can be expressive with it.

If you lost your way somewhere in the tutorial, don't worry the whole project is included in the examples in the ofxUI addon folder!

Note: If you don't need to save/load the gui settings and don't want to include ofxXmlSettings in your project, you can set the following define in your project build settings: OFX_UI_NO_XML

ofxUI was / is developed by Reza Ali (www.syedrezaali.com || [email protected] || @rezaali). Since its release in early 2012, its had more than 250 commits and now has 18 contributors: Camilo, obviousjim, prisonerjohn, syedhali, falcon4ever, SoylentGraham, NickHardeman, bilderbuchi, danomatika, rc1, emmanuelgeoffray, samdraz, danoli3, JohnSebastianHussey, markpitchless, kikko, and Garoe.

ofxui's People

Contributors

amicoleo avatar bilderbuchi avatar camilosw avatar cyrildiagne avatar danoli3 avatar danomatika avatar falcon4ever avatar fx-lange avatar jbott avatar johnsebastianhussey avatar julapy avatar markpitchless avatar millilux avatar mitchmindtree avatar nickhardeman avatar obviousjim avatar prisonerjohn avatar rc1 avatar rezaali avatar rvega avatar smallfly avatar snj33v avatar soylentgraham avatar syedhali avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ofxui's Issues

Changing ofxUICanvas position

Hi

I wanted to keep one of GUIs aligned to the right edge of the window. I tried to find methods or properties i'd need to update in the ofxUICanvas instance but direct access to it's rect attribute is not possible. Is there any way other to keep the canvas aligned to the right edge?

Cheers!

ofxUIDropDownList using deprecated ofxUILabelToggle constructor

This isn't very destructive issue in this version, but when you add DropDown, there's a lot of warnings, that something uses constructor of LabelToggle, which will be deleted in next version.
So I figured it out, that to repair that, you need to change file ofxUIDropDownList.h, in function void addToggle(string toggleName) after ofxUILabelToggle *ltoggle; there is an if, which to use correct constructors correct should be changed to:

if(autoSize)
{
ltoggle = new ofxUILabelToggle(0, yt, false, toggleName, size);
}
else
{
ltoggle = new ofxUILabelToggle(0, yt, rect->getWidth(), rect->getHeight(), false, toggleName, size);
}

I hope I helped you with repairing small bugs of ofxUI.

Sincerely,
domints

Inconsistent line height

try adding two buttons like this

saveButton = gui->addLabelButton("save", false);
stopButton = gui->addLabelButton("stop", false);

They aren't consistent. Perhaps internally the size is being calculated using the height of the text rather than the global line height?

Building examples on Windows

This is not a issue but a request. ofxUI looks awesome but I can't run any example on Windows (Visual Studio 2010). Project files doesn't include "ofxUI" paths, I have to add full paths when including headers and after that I got several link errors after building. Can you provide some simple tutorial on how to get started on windows?

The ouput when opening and converting a .vcproj file:
Conversion Report - .vcproj:
Converting project file 'C:\Users\mribeiro\Desktop\of_preRelease_v007_vs2010\apps\examples\example-ofxUIMoreWidgets.vcproj'.
Done converting to new project file 'C:\Users\mribeiro\Desktop\of_preRelease_v007_vs2010\apps\examples\example-ofxUIMoreWidgets.vcxproj'.
VCWebServiceProxyGeneratorTool is no longer supported. The tool has been removed from your project settings.
Attribute 'Detect64BitPortabilityProblems' of 'VCCLCompilerTool' is not supported in this version and has been removed during conversion.
Attribute 'Detect64BitPortabilityProblems' of 'VCCLCompilerTool' is not supported in this version and has been removed during conversion.
MSB8012: $(TargetName) ('emptyExample') does not match the Linker's OutputFile property value 'bin\emptyExample_debug.exe' ('emptyExample_debug') in project configuration 'Debug|Win32'. This may cause your project to build incorrectly. To correct this, please make sure that $(TargetName) property value matches the value specified in %(Link.OutputFile).
MSB8012: $(TargetPath) ('C:\Users\mribeiro\Desktop\of_preRelease_v007_vs2010\apps\examples\example-ofxUIMoreWidgets\bin\emptyExample.exe') does not match the Linker's OutputFile property value 'bin\emptyExample_debug.exe' ('C:\Users\mribeiro\Desktop\of_preRelease_v007_vs2010\apps\examples\example-ofxUIMoreWidgets\bin\emptyExample_debug.exe') in project configuration 'Debug|Win32'. This may cause your project to build incorrectly. To correct this, please make sure that $(TargetPath) property value matches the value specified in %(Link.OutputFile).

non uniform Widget Padding

It'd be really nice if i could set widget padding like in HTML, with three options

   widget->setPadding(padding);
   widget->setPadding(updown, leftright);
   widget->setPadding(up, right, down, left);

Hide drop down list when item is selected.

This is a question, not an issue.
What do I need to do to hide a dropdown list after it's been selected? I'm doing something like:

void MyApp::guiEvent(ofxUIEventArgs &e){ string name = e.widget->getParent()->getName(); if(name == "DROP_DOWN"){ //Do something... // What should I do here to hide the list?? } }

Easy method to check which of LabelToggles is selected in DropDownList

Is there any easy method to check what is selected in DropDown? Friend of mine found very weird way, but it seems the only legit. There isn't any method which allows developer to easily get index nor name of selected item. Could you make one, or show me easiest way to acheve this?

Wrongly named constant in ofxUICanvas.h

re: #20

In ofxUICanvas.h I had to change the version verification code from

#if OF_VERSION >= 7 && OF_VERSION_MINUS > 0

to

#if OF_VERSION >= 7 && OF_VERSION_MINOR > 0

in order to compile on the latest 0071. Maybe this constant changed names recently?

ltoggle->solid = true; used before ltoggle properly initializes

In ofxUIDropDownList.h on line ~142 there's ltoggle->solid = true; statement, which sets property of uninitialized ltoggle. In my compiler it shows only warning, but this I've been always taught that good programmer should get rid off even warnings.
I don't know how your compiler uses this, but I think, this statement is not making any change, because few lines later ltoggle gets completely new value without set ->solid. So I suggest just to move ltoggle->solid = true; few lines down, after the 'if' statement.

New toggle don't close DropDownList Autoclose

vector srclist;
...
ddl1 = new ofxUIDropDownList("Select", srclist, OFX_UI_FONT_SMALL);
ddl1->setAutoClose(true);
ddl1->addWidgetRight(ddl1);
ddl1->addToggle("New Toggle"); // Only this one don't auto close.

CodeBlocks each time recompile the ofxUI headers

Hello!

Small pre-history: (I have raised this question here: http://forum.openframeworks.cc/index.php/topic,10257.0.html)

I am developing a relatively simple C++ project in Ubuntu, basing on the OpenFrameworks toolkit, including the addon ofxUI. I use the CodeBlocks as IDE.

Each time when I build the project, it seems that the CodeBlocks and the gcc recompile all ofxUI files, in spite of the fact that these files have not been changed. In this case, it takes very much time to build the project every time even after a very tiny editing.

There is the "build log": http://pastebin.com/AMrRMAAY

I have tried to include ofxUI files to the CodeBlocks, but it does not benefit anyhow. I believe the solution for this problem should be very simple, it seems I do not understand something in the compilation process.

Main part

Thanks to arturo from the openFrameworks forum, he has supposed that the problem is that the whole ofxUI code is in header files, there are no "*.cpp" files. Could you tell, please, maybe, there is some solution to avoid recompiling the whole ofxUI code each time, excepting the solution to reprogram the ofxUI in a way of separating *.h and *.cpp files?

Thank you in advance!

Mousing out of widget on edge of canvas weird behavior

I have a lot of very small canvases with widgets -- when I mouse out of them most of the time the widget does not receive the mouse-exited event and stays highlighted. It makes things feel very 'sticky'

StickyWidgets

(the deletes are all highlighted)

A more compact way to setup the gui

Hi

I'm working on a more compact syntax to setup the gui, so instead of it

gui->addWidgetDown(new ofxUILabel("NAME", OFX_UI_FONT_MEDIUM)); 

we can do it:

gui->addLabel("TOGGLES"); 

addLabel return the ofxUILabel without the need of casting.

ofxUILabel* label = gui->addLabel("TOGGLES"); 

To set the font size, call the method setWidgetFontSize(int size):

gui->setWidgetFontSize(OFX_UI_FONT_LARGE); 

All the widgets created after the method setWidgetFontSize will be created with that size until another call to the same method with another value. Something similar to the way opengl work to set colors and sizes.

On my repository, I have an example called example-ofxUICompactSyntax with the work in progress. I would like to hear opinions.

textinput widget always drawing defaultstring instead of displaystring

hi, i hope i'm using the class properly. it seems that when i try to do setTextString(), it has no effect and always defaults to the initial value (default string). looking into the code i see that:

1.) during setTextString, the displaystring is set to the new value
2.) during drawing, it always draws defaultstring (which only gets updated during init).

Working on the compact syntax

Hi Reza

I pull your changes from develop and create a new branch called CompactSyntax2 to work on the changes for the compact syntax. The branch is here https://github.com/camilosw/ofxUI/tree/CompactSyntax2

Please see the changes and tell me if you agreed with them. This is a work in progress and will take some time to convert all the widgets to the compact syntax.

Do you think I need to create another example project to show the compact syntax or is bether to convert all the actual projects so the compact syntax is the default?

setVisible(boolean _visible) on ofxUICanvas has undesirable behaviour

If you setVisible(true) on an ofxUICanvas more than once it will keep calling enable multiple times. That means that I'll also will have to call setVisible(false) and/or disable multiple times if I want to hide the canvas.

One possible solution for this is the following code snippet:

    void setVisible(bool _visible)
    {
        visible = _visible; 
        if(visible && !isEnabled())
        {
            enable();
        }
        else if(!visible && isEnabled())
        {
            disable();
        }
    }

I'd post it as patch but I'm currently not using Git. So sorry for the inconvenience.

getValue() vs. getScaledValue()

for both ofxUISlider and ofxUI2DPad (and maybe others), getValue( ) returns a value between 0 and 1, and getScaledValue( ) returns a value in the min/max range.

I can see that internally the values are kept in [0,1] and scaled to min/max when getScaledValue( ) is called, but... I sort of expected getValue( ) to return numbers in the range that I used when initializing the object because, from a user's point of view, without looking at the internal implementation, those are the non-scaled values.

maybe getValue( ) could be renamed getNormalizedValue( )...

automatic width and height for compact syntax

first, i just want to say that this addon is awesome. the compact syntax has taken it from just being functional to being something i'm actually thinking of using regularly.

while using ofxUI i find myself repeating this pattern:

    gui = new ofxUICanvas(0, 0, length + xInit * 2, ofGetHeight());
    float dim = 20;
    float xInit = OFX_UI_GLOBAL_WIDGET_SPACING; 
    float length = 320 - xInit;
    gui->addLabelToggle("Toggle 0", &toggle0, length, dim);
    gui->addLabelToggle("Toggle 1", &toggle1, length, dim);
    gui->addSlider("Slider 0", 0, 10, &slider0, length, dim);
    gui->addSlider("Slider 1", 0, 10, &slider1, length, dim);

95% of the time, all i need is toggles and sliders :) and i'm always trying to reduce extraneous code, which is the reason ofxAutoControlPanel exists. so i'd love to be able to write:

    gui = new ofxUICanvas();
    gui->addLabelToggle("Toggle 0", &toggle0);
    gui->addLabelToggle("Toggle 1", &toggle1);
    gui->addSlider("Slider 0", 0, 10, &slider0);
    gui->addSlider("Slider 1", 0, 10, &slider1);

i know it's a little extreme, but would you consider calculating default values for w/h when using the compact syntax? and maybe even having a width/height only (always top left) constructor for ofxUICanvas that has a default width and height of 360 (used in one of your examples) and ofGetHeight()? what do you think?

edit: i just realized there's a ofxUICanvas(string title) constructor which is almost like the second thing i'm asking, but without the default width/height it's only halfway there.

No way easy way to change font size after creating a widget

the constructor for many widgets has fontsize at the end after the dimensions.

When using autosized controls, i generally want the dimensions to be figured out for me but often want to control the font size

so my constructors always end up looking like this:

 ofxUILabelToggle("OSC IN",false,0,0,0,0, OFX_UI_FONT_SMALL);

Ideally it would be this:

 ofxUILabelToggle("OSC IN", OFX_UI_FONT_SMALL);

or this

 ofxUILabelToggle* t = new ofxUILabelToggle("OSC IN",);
t->setFontSize(OFX_UI_FONT_SMALL);

Elements are always drawn without smoothing.

Even if I call ofEnableSmoothing() in setup(), elements are drawn without smoothing. This is most notorious with the default font included in your examples and with ofxUIRotarySlider.

overlapping drop down menus conflict

if i have a drop down menu below another one and click an item, it actives the menu below as well.

Should be a way to disable this, or am i missing something in how the dropdowns are configured?

ofxUIScrollable example drop framerate !

Hi rezali.
EDIT
I just test ofxUIScrollable example (iOS) and i notice dropped 24 FPS while ofSetFrameRate is set to 60FPS. ( Dropped framerates happen when window->enableAntiAliasing(4) enabled in main.mm).

Also.. how to disable the effect that moves up-down when scrolling has gone up in the end? The slider labels continues to move up down about 2-3 sec after the scroll stop.

Sorry for my english ! ( I hope you have understood what I mean.)

Feature Request: numerical input on ofxUINumberDialer

this would be really ace to mix typing text with this slider.

for example i'm using it for a BPM selector. If i'm just looking at a waveform, using the slider is a great way to match. but if I already know my BPM I'd rather just type it

Support for different font renderers

I have to get Duration working with double-byte charaters for Japanese translation, and so I can't use the built in ofTrueType font. I'm planning on using ofxFTGL or ofxFont

My initial thought is to just allow a #typedef for font to change the types, since oF lacks a "ofBaseFont" type class.

Wanted to know your thoughts, I'll keep you posted on how it gets solved

Problem with removing widgets

There is a problem with the removal of widgets.

To compare widgets you use the getName() function. But since this name is not always unique, one can run into trouble. For instance:

ofxUICanvas *canvas = new ofxUICanvas();

ofxUIButton *button1 = new ofxUIButton(20, 20, false, "button");
ofxUIButton *button2 = new ofxUIButton(20, 20, false, "button");

canvas->addWidgetDown(button1);
canvas->addWidgetDown(button2);

canvas->removeWidget(button2);

will always crash. This is because both have the same name internally. So when removing widget 2, you actually remove widget 1 from the widgets list but delete widget 2 from memory (but is still in the list). So either check for the object or add an unique identifier to check if they are the same.

default font choice

right now the default font is:

#define OFX_UI_FONT_NAME "GUI/NewMedia Fett.ttf"

this is a little painful because it means every project has to have a ttf asset in the data folder.

i'd like to suggest loading a built-in platform specific font. for example, on OSX:

#define OFX_UI_FONT_NAME "/System/Library/Fonts/HelveticaLight.ttf"

right now i'm doing this by setting the font after setting up the ofxUICanvas, which has the side effect of the app printing some error messages about how it can't find NewMedia Fett, but it eventually gets over it.

i'm also going to suggest this to the openFrameworks repo because it might make more sense to solve it at that level.

ofSetBackgroundAuto issue !

Hi rezaali.
I use ofSetBackgroundAuto (false) in my iOS app, but I have a problem with ofxUI because it remains on screen after the call gui-> toggleVisible ().

Probably has nothing to do with ofxui but I want to know if there is any solution (trick) for this case.
I don't want to clear the background, I just want to show/hide UI without affect in the background.

Thank you.

iOS Release mode crash

Crashes on:
std::string::_Rep::_M_dispose(std::allocator const&)

Caused by string allocations within ofxUI.

base = "name" for example.

Error with ofxUIFPSSlider

When I compiled the ofxUICustomization example I got the next error on the line 37 of testApp.cpp:

D:\Personal\Proyectos\OpenFrameworks\of_v0071_win_cb_release\addons\ofxUI\example-ofxUICustomization\src\testApp.cpp||In member function 'virtual void testApp::setup()':|
D:\Personal\Proyectos\OpenFrameworks\of_v0071_win_cb_release\addons\ofxUI\example-ofxUICustomization\src\testApp.cpp|37|error: call of overloaded 'ofxUIFPSSlider(float, double, int, int, int, const char [11])' is ambiguous|
..\src\ofxUIFPSSlider.h|48|note: candidates are: ofxUIFPSSlider::ofxUIFPSSlider(float, float, float, float, float*, std::string)|
..\src\ofxUIFPSSlider.h|38|note: ofxUIFPSSlider::ofxUIFPSSlider(float, float, float, float, float, std::string)|
||=== Build finished: 1 errors, 0 warnings ===|

Unexpected behavior: hitting 'enter' on ofxUITextInput clears

everyone who I've given the app too (including myself) tries to hit 'enter' after typing something into the text input and is very surprised when that action clears the whole field.

I think the default behavior should be that enter confirms the current value and takes focus off of the cursor.

Also now that you have a modal system, perhaps you can make the text entry boxes model when they are being entered so the mouse doesn't have to be hovering above the field the whole time?

Triggering a slider event only on release

What would be the best way to only respond to the event from a slider only when the mouse is released, instead of on every mouse movement?

My workaround was to add a "getState()" call to the ofxUIwidget base class and add to my handler this logic:

if(slider->getState() != OFX_UI_STATE_DOWN) { ... }

If there's a cleverer way to do it, would love to know, or otherwise hopefully you'll consider this for a future release.

ofxUI2DPad not working properly with ofxUIScrollableCanvas

If I put a 2DPad in a ScrollableCanvas, the 2DPad height does not seem to be calculated in the canvas height. Whenever I try to scroll, it bounces back as if the height is too short. Also, I don't get this problem if I replace the 2DPad by a bunch of Sliders.

I also noticed that if I turn off snapping, allowing me to scroll freely, the 2DPad hit test doesn't work when the canvas is scrolled.

Here is the code I am working with:

    static float dim = 16;
    static float xInit = OFX_UI_GLOBAL_WIDGET_SPACING;
    static float length = 320 - xInit;

    _controls = new ofxUIScrollableCanvas(0, 0, length + xInit * 2.0, ofGetHeight());
    _controls->setScrollableDirections(false, true);
    _controls->addFPS();

    _controls->addSpacer(length, 2);
    _controls->addLabel("VIDEO");
    _controls->addSlider("video position", 0, 1, &_videoPosition, length, dim);
    _bDrawRedChannel = true;
    _controls->addToggle("draw red channel", &_bDrawRedChannel, dim, dim);
    _target = 255;
    _controls->addSlider("target", 0, 255, _target, length, dim);
    _threshold.set(0.6f, 0.1f, 0.0f);
    _controls->addSlider("hue threshold", 0, 1, &_threshold.x, length, dim);
    _controls->addSlider("saturation threshold", 0, 1, &_threshold.y, length, dim);
    _controls->addSlider("brightness threshold", 0, 1, &_threshold.z, length, dim);

    _controls->addSpacer(length, 2);
    _controls->addLabel("FIREBALL");
    _bDebugFireball = false;
    _controls->addToggle("debug fireball", &_bDebugFireball, dim, dim);
    _controls->addSlider("fireball position", 0, 1, &_fireball.position, length, dim);
    _controls->addSlider("fireball radius", 0, 250, &_fireball.radius, length, dim);
    _controls->addSlider("fireball speed", 0, 1, &_fireball.speed, length, dim);

    _controls->addSpacer(length, 2);
    _controls->addLabel("LIGHT SCATTERING");
    _controls->addToggle("use light scattering", &_fireball.bUseLightScattering, dim, dim);
    _controls->addSlider("exposure", 0, 1, &_fireball.exposure, length, dim);
    _controls->addSlider("decay", 0, 1, &_fireball.decay, length, dim);
    _controls->addSlider("density", 0, 2, &_fireball.density, length, dim);
    _controls->addSlider("weight", 0, 10, &_fireball.weight, length, dim);
    _controls->add2DPad("light position", ofPoint(-1, 1), ofPoint(-1, 1), &_fireball.lightPos, length, length);

    _controls->addSpacer(length, 2);
    _controls->addLabel("DISPLACEMENT");
    _controls->addToggle("use displacement", &_fireball.bUseDisplace, dim, dim);
    _controls->addSlider("max height", 0, 100, &_fireball.maxHeight, length, dim);

    ofAddListener(_controls->newGUIEvent, this, &HeatSinkApp::guiEvent);
    _controls->loadSettings("controls.xml");
    _controls->setVisible(false);

Thanks!

ofxUILabel Crash on 'Tab' Key - Windows

Windows 7, oF 7, ofxUI pulled May 9th:

ofxUI causes a crash with hitting the Tab key between ofxUILabel Fields in both Debug and Release builds.

Stack trace breaks at

  • ofxUILabel, ln 171 - getStringWidth
  • ofTrueTypeFont, ln 635 - getStringBoundingBox
  • ofTrueTypeFont, ln 676 - GLint height
  • vector, ln 972 - size() <= _pos

The error does not occur on OSX builds of the same application. Using the TTF included with ofxUI.

Precision zone feedback for ofxUINumberDialer

It took me about 5 minutes to figure out how to work this control, and I had to look at the code to see that it was referencing the X value of the click and drag.

I think a little feedback that where your mouse is controls the precious would be helpful - Maybe if it were just drawing a line by the cursor, getting thicker or thinner depending on how precise it would be?

'ofImage' has no member named 'drawSubsection'

When I tried to compile ofxUIAllWidgets, error messages were showed up. It said " error: 'ofImage' has no member named 'drawSubsection' ". The errors were found in ../addons/ofxUI/src/ofxUIImageSlider.h (line 172, 179, 194 and 201) and various other files. I use Code::Blocks 10.05 and OF 007 in Ubuntu 12.04.

ofxUI - drop down lists

Hi Reza,

I'm trying to use your great addon (ofxUI), but I'm having some problems with drop down lists,
What I want is to use a drop down list that is populated with file names, and I want to select one from the list
and use that name to read a file.
How can I known that the user selected an item from the list, and how can I get the item value?
Best regards,

Paulo Trigueiros

Last commit on development branch incompatible with OF 0071

@rezaali, on your last commit, you changed

setTextString(ofToString(*value, precision));

to

setTextString(ofToString(abs(*value), precision, numOfPrecisionZones, '0'));

This change is only compatible with the OF development version, not with 0F 0071.

On the development branch they doesn't have changed the version definitions on ofConstants.h, so there is no way to solve the problem with this solution for now:

if OF_VERSION >= 7 && OF_VERSION_MINUS > 1

setTextString(ofToString(abs(*value), precision, numOfPrecisionZones, '0'));

else

setTextString(ofToString(*value, precision));

endif

Crash when creating an ofxUIMultiImageToggle

Ran into a crash when just creating this widget

   playpause = new ofxUIMultiImageToggle(32, 32, false, "GUI/play_.png", "PLAYPAUSE");

the crash is here:

virtual void setValue(bool _value)
{
    *value = _value;         //dies -- value has not been allocated
    draw_fill = *value; 
    label->setDrawBack((*value));         
}

If I add a call to the superclass init from ofxUIToggle init like so:

ofxUIButton::init(w, h, &_value, _name, _size);

it fixes it because then bool get's created. But that may not be the right style, so please advise a better way to avoid this problem

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.