Comments (8)
Hi. The scrolling behaviour is what I intended. I often end up with long list that go out of screen so scrolling is kinda needed. When scrolling I would assume that if the mouse is over the dropdown you can simply clic on the option you want.
It is strange that you have things behaving differently with ofxGuiGroup and ofxPanel, as the latter inherits from the former and the only addition to ofxPanel are the save and load buttons on the top right corner.
What you mention about not seeing the borders is an OF "bug" You can customize it though. There are a bunch of padding static variables in ofxBaseGui which control that thing.
As of the idea of showing the dropdown on mouse over it is actually a nice one. It does not sound like a complex thing to implement at all, and I agree it could be quite handy.
One last question, is it possible to disable the collapse function without disabling the header of the gui?
As far as I can recall, you cant without modifying ofxGui.
from ofxdropdown.
@Jonathhhan no worries. Glad to help.
And it was me who named that a "bug". :D
So, you can also use an std::map<std::string, std::string>
and pass that to the drop down, where the first value is "value" and the second is the string drawn in the dropdown. This way, for instance you can hold the full info of each audio midi device but just show a friendlier name.
You can also add elements to the dropdown without the vector or map, just one by one. It might be handier if you are actually populating the vector somehow and then passing it to the dropdown instance.
from ofxdropdown.
Hmm, now somehow the right border of the dropdown options is not shown.
Actually I do not need a right / left border at all, that would be consistent with the main options?
Or is there just that one border to mark the start of the dropdown menu?
That is the code of my attempt:
https://github.com/Jonathhhan/ofEmscriptenExamples/blob/main/dropdown_audio_select/src/ofApp.cpp
And another idea, would it be possible, that the options appear onmouseover and dissapear onmouseout, so no click would be needed to make them appear / disappear. That would be really handy, at least as an option (I tried to figure it out, but no luck...). Anyway, thanks for this very useful addon. One last question, is it possible to disable the collapse function without disabling the header of the gui?
from ofxdropdown.
BTW, as for your example.
Check the ofxDropdown example_FolderFiles. It can auto populate the dropdown from a directory.
from ofxdropdown.
@roymacdonald hi, and thank you for the clarifications, that helps.
And sorry for naming that a bug, i just do not know ofxGui
enough, I will check the variables out...
I had a look at the example, but I guess I will have a std::vector<std::string>
for populating the menu (I will get a list of audio / midi devices from Java Script) and not files from a directory.
from ofxdropdown.
So, you can also use an
std::map<std::string, std::string>
and pass that to the drop down, where the first value is "value" and the second is the string drawn in the dropdown. This way, for instance you can hold the full info of each audio midi device but just show a friendlier name.You can also add elements to the dropdown without the vector or map, just one by one. It might be handier if you are actually populating the vector somehow and then passing it to the dropdown instance.
@roymacdonald
Thank you, with webMidi that works pretty well (show the name and return the id).
I need to make a vector of the string anyway with ofSplitString(), so in my case it does not matter but good to know.
I populate it like that:
void loadMidiInDevices(std::string string){
std::vector<std::string> deviceList = ofSplitString(string, ",", true);
midiInputDropdown->clear();
for(int j = 0; j < deviceList.size(); j += 2){
midiInputDropdown->add(deviceList[j], deviceList[j + 1]);
}
midiInputDropdown->forceRedraw();
}
Here is the example: https://github.com/Jonathhhan/ofEmscriptenExamples/tree/main/webmidi_draft
from ofxdropdown.
@Jonathhhan That looks good. Glad that this addon is helpful
from ofxdropdown.
@roymacdonald yes, its really helpful. thank you. here is a demo: https://mtest.handmadeproductions.de/
Even if you connect / disconnect new devices the menu is updated nicely.
Only the onmouseover feature would be really great, too.
from ofxdropdown.
Related Issues (17)
- Example for selecting a file in a folder HOT 2
- Dropdown not clickable if on top of other gui components HOT 6
- The dropdown can be drawn outside of the window HOT 2
- How using dropdown inside a ofParameterGroup? HOT 2
- collapse on selection and multi selection reversed HOT 1
- how to refresh string dropdown list? HOT 6
- Type 'ofParameter<ofFile>' does not provide a call operator HOT 1
- selected name / id
- New version: Options position and darkened background HOT 5
- options does not disappear, if clicking an already selected option. HOT 1
- Load settings HOT 6
- Fails on Linux
- Values of the dropdown do not get loaded when calling gui.loadFromFile HOT 4
- disableHeader member missing from ofxGuiGroup HOT 5
- Compiling on Linux HOT 6
- Windows '<<': no operator found which for typedef ofxDropdown_<ofFile> HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ofxdropdown.