GithubHelp home page GithubHelp logo

Mouse scroll behaviour about ofxdropdown HOT 8 CLOSED

Jonathhhan avatar Jonathhhan commented on August 27, 2024
Mouse scroll behaviour

from ofxdropdown.

Comments (8)

roymacdonald avatar roymacdonald commented on August 27, 2024 1

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.

roymacdonald avatar roymacdonald commented on August 27, 2024 1

@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.

Jonathhhan avatar Jonathhhan commented on August 27, 2024

Hmm, now somehow the right border of the dropdown options is not shown.
Screenshot from 2022-12-13 03-34-05
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.

roymacdonald avatar roymacdonald commented on August 27, 2024

BTW, as for your example.
Check the ofxDropdown example_FolderFiles. It can auto populate the dropdown from a directory.

from ofxdropdown.

Jonathhhan avatar Jonathhhan commented on August 27, 2024

@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.

Jonathhhan avatar Jonathhhan commented on August 27, 2024

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.

roymacdonald avatar roymacdonald commented on August 27, 2024

@Jonathhhan That looks good. Glad that this addon is helpful

from ofxdropdown.

Jonathhhan avatar Jonathhhan commented on August 27, 2024

@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)

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.