harsha Posted March 11, 2016 Report Posted March 11, 2016 Hi Team, Thanks for you quick response on the earlier thread. Just we need to know wether container is clickable or not. If yes can you explain a bit on how to get click events on that. Thanks in advance, Harsha
Joel Bodenmann Posted March 11, 2016 Report Posted March 11, 2016 Containers don't generate any click events. If you explain to us what you want to do / what you are trying to archive we can tell you how it should be done the right way.
king2 Posted March 11, 2016 Report Posted March 11, 2016 You can make everything clickable just by placing a clear button over area you want to generate events:
Joel Bodenmann Posted March 11, 2016 Report Posted March 11, 2016 That IS NOT the recommended method of handling this and it is strongly recommended not to do that. Doing that will not work in all cases and will cause problems. That's just a work-around from somebody who didn't want to listen to the explanations and the advice of the µGFX developers
king2 Posted March 11, 2016 Report Posted March 11, 2016 I have 7 windows already (2 or 3 more coming), with same background containing window header and static text on it with name of project; in one of that windows I wanted part of background to be clickable (tap on project name of main window should bring settings window on top). Which other way I can use to be absolutely compatible with µGFX developer's advices?
harsha Posted March 14, 2016 Author Report Posted March 14, 2016 (edited) So we have container in our application which contains label and image widget. We want to make our container to accept click events. So currently in my code I have geventListenerInit(&gl); gwinAttachListener(&gl); Do I need to attach any source. If yes can you tell me how?? while(1) { pe = geventEventWait(&gl, TIME_INFINITE); switch(pe->type) { case GMETA_MOUSE_CLICK: (what is the type I have to check for) std::cout<<"click"<<std::endl; break; default: break; } } Edited March 14, 2016 by harsha
Joel Bodenmann Posted March 14, 2016 Report Posted March 14, 2016 The proper way of doing this is by implementing a custom rendering routine for the button widget. In µGFX the widgets are specified by their behavior, not by their appearance. When you need something that is clickable, you take a button and change how it looks. If you need something that takes a range of values, you take a slider and make it look like you want. This is the core philosophy of the µGFX library. This article explains how you can implement your own custom rendering routine. In fact, the guide is prefect for you because it shows how to create a custom rendering routine for a button that has a label and an image - exactly what you want: http://wiki.ugfx.org/index.php/Creating_a_custom_rendering_routine If you have more advanced needs, you can even implement your own widget from scratch. Please do not hesitate to ask if you have any other questions.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now