king2 Posted January 28, 2016 Report Share Posted January 28, 2016 I have read thread about how to make text label with transparent background. As I understand, still no label transparent background patch in uGFX? Link to comment Share on other sites More sharing options...
Joel Bodenmann Posted January 28, 2016 Report Share Posted January 28, 2016 Adding a drawing function for the label widget that doesn't clear the background (so it's transparent) is fairly easy and you can either do that yourself by creating your own custom rendering routine as explained in this article or we can add it to be an official built-in rendering routine for the label widget. It's really just a matter of minutes.The reason it's not there yet is because it doesn't make much sense. When you change the text of the label you NEED to clear the previous text - otherwise you'll just stack the two texts. Clearing the previous text happens through filling the label area with the background. When using a transparent background we don't know the background in the label rendering function so we can't clear it. This would mean that when using a label with a transparent background you'll have to clear the area yourself before the label gets redrawn.~ Tectu Link to comment Share on other sites More sharing options...
king2 Posted January 28, 2016 Author Report Share Posted January 28, 2016 Sure, I can write workarounds, but I hate too much workarounds, especially ones that copies 99% of original code I understand that transparent background requires to redraw underlying objects. I can do it (refresh my button) by myself when updating text in label (but it will be better if this will do window manager for all underlying objects).OK, it is point to decide will I write my own window manager, transparent text labels, sending events by labels and progressbars, and so on, or not...Thanks for answers.. Link to comment Share on other sites More sharing options...
Joel Bodenmann Posted January 28, 2016 Report Share Posted January 28, 2016 Well, in this case it's not a workaround as being able to submit custom rendering routines is expected usage and in fact one of the main goals of the GWIN modules: Everything is supposed to be fully customizable. That is also the reason why you can submit your own window manager. Most other libraries don't offer this Note: Judging from the screenshots that you've shown in the uGFX-Studio thread it seems like you only need to be able to stack widgets because you want a special button that shows an icon, two volume levels and a text. Personally I think that in your case it's the best solution to write your own widget that does exactly that. I guess 90% of the rendering function of this new custom widget can be copy-pasted from the button, the progressbar and the label.That custom widget would then provide an interface like myWidgetSetLevelLeft() and myWidgetSetLevelRight() for the two volume progress bars and so on. As you only need one text attribute (again, judging from what we've seen in your studio screenshots) you can keep using the built-in text attribute from the GWIN base class.When you take a closer look at some of the built-in widgets you can see that most advanced widgets are implemented this way. Take the frame widget for example. The frame widget provides buttons in the window decoration (window border). However, these buttons are not real GWIN PushButtons. Instead it's just an area that gets drawn in the rendering function using primitive gdispDrawXxx() calls and in the touch coordinates handling functions we just check whether the touch occurred inside of those areas. The same applies to the list widget (the scroll bar) and so on. This technique allows to implement advanced widgets using very little resources. This keeps your application small and fast even when you need such an advanced widget as in your case.We are happy to help you where we can whenever you have any questions.~ Tectu Link to comment Share on other sites More sharing options...
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