Jump to content

Disable Button Redraw on Press


kengineer

Recommended Posts

I have implemented a custom draw function for a button (image icon). Due to performance limitations on my system, drawing images is somewhat slow. Because of this, I don't want uGFX to call the draw function every time I press the button as this is unnecessary (I'm not changing the icon upon press) and results in latency. Is there a native or built in way to uGFX that I can implement this?

Link to comment
Share on other sites

Not easily in ugfx V2. V3 (which is still in the design phase) is likely to have a mechanism to handle this.

The solution for uGFX V2 is to copy the source code for the button to your project, rename the create routine to something like gwinButtonExCreate() and then alter the mouse down code so that it doesn't call _gwinUpdate(). For now this is the simplest solution.

 

Link to comment
Share on other sites

To clarify what @inmarket said: The solution in the current version of uGFX is to create a custom widget. More information can be found here: http://wiki.ugfx.org/index.php/Creating_a_widget

As it's basically 1:1 the existing pushbutton widget you simply copy the pushbutton widget files (/src/gwin/gwin_button.[ch]) to your project and modify it as per inmarket's explanation.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...