GithubHelp home page GithubHelp logo

ofxdropdown's People

Contributors

edap avatar hamoid avatar kasparsj avatar roymacdonald avatar

Stargazers

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

Watchers

 avatar

ofxdropdown's Issues

Mouse scroll behaviour

Not sure if this is intended, but with ofxPanel mousescrolled moves the options up and down the screen (with ofxGuiGroup nothing happens). I would rather expect scroll to change the preselected option (like with mouse move), so that you can select it with enter (for example), if not with clicking the option (that would be nice for ofxGuiGroup, too). Also, if I move the ofxPanel, the option do not move with it. And, is it possible to hide the option on "onmouseout", if the mouse leaves the ofxPanel / ofxGuiGroup or the selected option?
All the ofxPanel issues do not affect my case, because I use ofxGuiGroup, just wanted to mention it.

How using dropdown inside a ofParameterGroup?

Is it possible to use the dropdown menu as part of a ofParameterGroup?
Or can it only be part of an ofxPanel ?

//in ofApp.h
ofParamaterGroup group_test;

//in ofApp.cpp
    group_test.setName("test group");
    intOptions.setName("INT Options");
    intDropdown =  make_unique<ofxIntDropdown>(intOptions);
    group_test.add(intDropdown->getDropdownParameters());

    for(int i = 0; i < 15; i++){
            intDropdown->add(i, "Opcion " + ofToString(i));
    }
    group_test.add(intDropdown.get());
    gui.add(group_test);

Compiling on Linux

When I try the example-basic on Ubuntu, I get this :

In file included from /home/anas/of_v0.11.0_linux64gcc6_release/addons/ofxDropdown/example_Basic/src/ofApp.h:5,
                 from /home/anas/of_v0.11.0_linux64gcc6_release/addons/ofxDropdown/example_Basic/src/main.cpp:2:
/home/anas/of_v0.11.0_linux64gcc6_release/addons/ofxDropdown/src/ofxDropdown.h: In instantiation of ‘class ofxDropdown_<std::__cxx11::basic_string<char> >’:
/usr/include/c++/9/bits/unique_ptr.h:79:16:   required from ‘void std::default_delete<_Tp>::operator()(_Tp*) const [with _Tp = ofxDropdown_<std::__cxx11::basic_string<char> >]’
/usr/include/c++/9/bits/unique_ptr.h:292:17:   required from ‘std::unique_ptr<_Tp, _Dp>::~unique_ptr() [with _Tp = ofxDropdown_<std::__cxx11::basic_string<char> >; _Dp = std::default_delete<ofxDropdown_<std::__cxx11::basic_string<char> > >]’
/home/anas/of_v0.11.0_linux64gcc6_release/addons/ofxDropdown/example_Basic/src/ofApp.h:6:7:   required from here
/home/anas/of_v0.11.0_linux64gcc6_release/addons/ofxDropdown/src/ofxDropdown.h:129:7: error: ‘void ofxDropdown_<T>::registerMouseEvents() [with T = std::__cxx11::basic_string<char>]’ marked ‘override’, but does not override
  129 |  void registerMouseEvents() override;
      |       ^~~~~~~~~~~~~~~~~~~
/home/anas/of_v0.11.0_linux64gcc6_release/addons/ofxDropdown/src/ofxDropdown.h:130:7: error: ‘void ofxDropdown_<T>::unregisterMouseEvents() [with T = std::__cxx11::basic_string<char>]’ marked ‘override’, but does not override
  130 |  void unregisterMouseEvents() override;
      |       ^~~~~~~~~~~~~~~~~~~~~
/home/anas/of_v0.11.0_linux64gcc6_release/addons/ofxDropdown/src/ofxDropdown.h: In instantiation of ‘class ofxDropdown_<int>’:
/usr/include/c++/9/bits/unique_ptr.h:79:16:   required from ‘void std::default_delete<_Tp>::operator()(_Tp*) const [with _Tp = ofxDropdown_<int>]’
/usr/include/c++/9/bits/unique_ptr.h:292:17:   required from ‘std::unique_ptr<_Tp, _Dp>::~unique_ptr() [with _Tp = ofxDropdown_<int>; _Dp = std::default_delete<ofxDropdown_<int> >]’
/home/anas/of_v0.11.0_linux64gcc6_release/addons/ofxDropdown/example_Basic/src/ofApp.h:6:7:   required from here
/home/anas/of_v0.11.0_linux64gcc6_release/addons/ofxDropdown/src/ofxDropdown.h:129:7: error: ‘void ofxDropdown_<T>::registerMouseEvents() [with T = int]’ marked ‘override’, but does not override
  129 |  void registerMouseEvents() override;
      |       ^~~~~~~~~~~~~~~~~~~
/home/anas/of_v0.11.0_linux64gcc6_release/addons/ofxDropdown/src/ofxDropdown.h:130:7: error: ‘void ofxDropdown_<T>::unregisterMouseEvents() [with T = int]’ marked ‘override’, but does not override
  130 |  void unregisterMouseEvents() override;
      |       ^~~~~~~~~~~~~~~~~~~~~
Process failed with exit code 1.

The dropdown can be drawn outside of the window

If the component is near the bottom border of the window, the dropdown is not visible. I didn't test but the same might happen if the component is near the right edge of the window.

As a solution one could test for these conditions and make sure the dropdown is placed inside the visible area.

Values of the dropdown do not get loaded when calling gui.loadFromFile

Hello Roy, I am currently using this addon and I have noticed that when calling gui.saveToFile(myFile) the selected option is correctly saved, but when calling gui.loadFromFile(myFile) the selected option saved in the file it is not reflected in the GUI, as it is happening for the other parameters.

Type 'ofParameter<ofFile>' does not provide a call operator

I am trying to use the populateFromDirectory example but am not able to query which item is current selected in the dropdown file selector.
I know I could use the listener to update an other string to hold the current file name. But ...

Screen Shot 2022-09-04 at 9 54 31 PM

selected name / id

Is it possible to get the name / id of the selected option? It would be helpful for deselecting the option if it is not in the updated options list.

Load settings

When I load the settings, the correct options appear selected, however the function getAllSelected() return empty (for fields that allow multi selection) and channels[i].get()->selectedValue also return empty. I have to click on the highlighted selection for it to be returned.

for(int i = 0; i < 24; i++)
    {
        unique_ptr<ofxIntDropdown> aux;
        aux = make_unique<ofxIntDropdown>("Fixture "+ ofToString(i+1));
        aux->disableMultipleSelection();
        aux->enableCollapseOnSelection();
        channels.push_back(std::move(aux));
    }
    unique_ptr<ofxIntDropdown> aux;
    aux = make_unique<ofxIntDropdown>("Grouping "+ ofToString(1));
    aux->enableMultipleSelection();
    aux->disableCollapseOnSelection();
    channels.push_back(std::move(aux));

This is how i'm creating and adding the options to the panel.

Example for selecting a file in a folder

Maybe it helps someone...

// .h
#pragma once

#include "ofMain.h"
#include "ofxGui.h"
#include "ofxDropdown.h"

class ofApp : public ofBaseApp {
    public:
        void setup();
        void draw();
        void onSongChange(ofFile & file);

        ofxPanel gui;

        unique_ptr<ofxDropdown_<ofFile>> songDropdown;
};
// .cpp
#include "ofApp.h"

void ofApp::setup() {
    songDropdown = make_unique<ofxDropdown_<ofFile>>("Song");
    songDropdown->enableCollapseOnSelection(true);
    songDropdown->populateFromDirectory("/home/bla/myOfProject/bin/data/sounds", { "mp3"});
    songDropdown->addListener(this, &ofApp::onSongChange);

    gui.setup("gui", "DropdownsSettings.xml");
    gui.add(songDropdown.get());
}

void ofApp::draw() {
    gui.draw();
}

void ofApp::onSongChange(ofFile & file) {
    std::cout << file.path() << std::endl;
}

how to refresh string dropdown list?

I understand how to fill the dropdown menu with values via the ->add function.

But what about changing / updating the content during run time?

Right now I am testing.

 IP_strDropdown->clear();
        IP_strDropdown->add("offline");
        
        vector<string> ip_list = getLocalIPs();
        for(int i=0; i<ip_list.size(); i++){
            ofLog()<<ip_list[i];
            IP_strDropdown->add(ofTrim(ip_list[i]));
        }

        ofLog()<<"myIP "<<myIP<<" IP_strDropdown "<<IP_strDropdown->getDropdownParameters().size();

IP_strDropdown->getDropdownParameters().size() does report the updated size but the gui element does not show the new options.

thanks for your advice.

Fails on Linux

This is the error message I am receiving when I compile the example:

addons/ofxDropdown/src/ofxDropdown.cpp:33: error: returning a value from a constructor
  return setup(name, width, height);
                                  ^

New version: Options position and darkened background

Hey @roymacdonald.
Is it possible to disable the darkened background when options are shown?
And somehow the position of the options seems wrong(also in the FolderFiles example). Both is not an issue with the older version.
And sorry for my last issue, I was using the older version until now.
Here is a screenshot from the current version:

Screenshot from 2022-12-18 21-03-01

disableHeader member missing from ofxGuiGroup

openFrameworks/addons/ofxDropdown/src/ofxDropdown.cpp:46:8: error: no member named
'disableHeader' in 'ofxGuiGroup'
group.disableHeader();
~~~~~ ^
what version of ofxGui (ie of openframeworks) does ofxDropdown compile against?

Dropdown not clickable if on top of other gui components

If there are other panels where the dropdown is shown, it is not possible to click on those items. Even if I changed the order to make sure the dropdown is drawn last, the mouse movements are captured by the other gui. Maybe the first component to be drawn is the one that gets the the mouse input.

For now I'll tell the user to collapse the conflicting panel if they want to change the song.

image

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.