I am working on a project with qwt. And what I am trying to do is obtaining the coordinates where my mouse click on. I searched on the Internet and find it might be relevant to the QwtPlotPicker class. But I can't find any function that may meet my need in the official document. Is there any example I can refer to? Any help will be appreciated.
Related
I am building a leaderboard screen in the flutter application, whenever the user comes to the leaderboard screen, I want to show the animation of his old position to a new position in the leaderboard, so I need an animation of this row to go up or down based on his standings, please someone help me which widget to use to get this functionality working. Thanks
AnimatedList is the widget you are looking for. It automatically generates entrance and exit animation when items are added/deleted. Combined that with SizeTransition, and you will get a nice "growing/shrinking" effect.
There are some really good examples (and even a video tutorial) on the official docs as well.
You can also look at this answer for a more complex example of using 2 of them.
This question already exists:
Can you get the mouse position and if it is clicked in a console app? [duplicate]
Closed 3 years ago.
Say I was building a simple game and I had a menu with Play, Settings, Music etc. All laid out in the middle of the screen, how would I check if the mouse was over one of those areas and if the mouse clicked while over one of those areas?
Other people have asked similar things to this but I cannot find a working example or a clear solution to my question.
For clicking and mouse input, there are libraries/APIs that give user input (such as GLFW with Opengl). It really depends on what platform you're using. Then, you can convert your mouse XY position to a position relative to the window, and see whether or not its XY is greater than the bottom left XY of the GUI and less than the top right XY.
I am no expert in GUI in C++ because C++ GUI is not efficient. But to be making a clickable button, you may not want to do all those hard works. All you need to find is how to add a button from some libraries and bind that button to certain function. That’s how things work.
Additionally, you should have provided information regarding to what you have tried and the problem you are facing to give others less headaches
I was looking online and how people created this virtual mouse application using different principles such as color detector, object tracking, convexity defects etc etc. I wrote this program which actually tracks a single object from a webcam and its actually working really well. Now, the idea is to use this moving object which is being tracked and i want to control my mouse using this application. I dont want the source code and i want to do it myself. But i dont have any clue how to start it. I just hope if you guys can give me some clue or some ideas which can help me to connect my mouse to my program? I want to be able to do left click, right click, double click . Thanks
If you are able to track an object in the screen then you will get the object co-ordinates & set that as your target co-ordinate. I assume you already did that.
Now set the mouse cursor to that target co-ordinate refer this thread.
I'm developing an application with C++ and GTK3 but I'm stucked. I've created a visual application with glade which has three columns and one of them, the middle one, is a DrawingArea. In that DrawingArea I want to draw some circles at the point I want to after pressing a button and have different mouse events on that circles (like drag and drop, double click, right click...). I've made the first thing (draw a circle after pressing a button) following the official documentation, but the problem is that I don't know how to do the mouse events, but I thought about it and I have some different solutions (I don't know if they are the bests solutions or maybe there are better):
I think the best way is to create a signal to the cairomm context, but I didn't see anything to do that. Maybe the way would be to create a cairo surface or something like that.
Every time I click to create a circle, I would have to create a gtk widget in which I can handle mouse events. The problem here is that the widget needs to have circular shape and need to be drawable. Is it possible to create a circular DrawingArea? It could be the best. I saw the way to create custom widgets here.
Use goocanvasmm. The problem here is that goocanvasmm has a little documentation (I'm sorry I can not post more than two links because of my reputation) and I think this is not the best solution, I prefer to use cairomm.
This application was written in C using GTK2, and the circles were drawn using gnomecanvas, adding signals in an easy way to each circle; and now I'm moving this application to C++ and GTK3 to renew it.
I'm very new to GTK (and graphical interfaces in general), but I looked for solutions for hours and I don't know what is the best way in order to continue my work.
Thank you for your help :)
It's best to use a canvas library for this such as GooCanvas. Doing it with cairo alone would require you to listen to mouse events on the whole drawing area, and keep track of where the circles were in order to decide which circle the mouse event belongs to - exactly the problem which the canvas library has already solved for you.
If you are having trouble with goocanvasmm documentation, a look at the documentation for GooCanvas' C API combined with knowledge of how the C API translates into C++ will usually suffice. Although the GooCanvasmm documentation seems fairly extensive to me.
I'm working on an application, and part of it is making the user create a shapes such as squares or rectangles. I'm wondering if there is a function in wxwidgets that enable the user to do that. What i want to do is the user will click this button then he/she can draw a square or rectangle in his/her desired size. It is like in paint where you can make your own size in your desired size. Is that possible in wxwidgets and codeblocks? maybe some related links or tutorials or anything that will help. thanks !!
You should use this contrib library:
Object Graphics Library
OGL defines an API for applications that need to display objects connected by lines. The objects can be moved around and interacted with. You can find this in contrib/src/ogl, contrib/include/wx/ogl, and contrib/samples/ogl.
This is the link:
http://docs.wxwidgets.org/2.8/wx_utilities.html
Max
Titles sais context here is "drawing", ok.
But in case you are talking about user-created rectangles as means of selecting stuff (or users end up here while searching for that context), jargon for that is rectangles as selection is "marquee selection", and you would look into Wx::Overlay to accomplish that.