Jump to content

How to create a new Widget with a button?

Recommended Posts


my LCD size is 240x320。

when uGFX power on,I created a Widget  with only two buttons。

When a user clicks on different buttons, there will be different Widget (full screen).

but,I dont`t know how to create a new Widget with a button click event!





Share this post

Link to post
Share on other sites

Well, just call gwinXxxCreate() to create your widget when you receive the button press/release event.

However, this is usually bad practice. When you have enough resources (mainly talking about RAM) you create all the widgets you need during startup/initialization and then you just use gwinShow() and gwinHide() to display the widgets correctly. The handling of touch inputs and so on is all handled through the GWIN visibility and enabled state.

Share this post

Link to post
Share on other sites


I used Menu sample code! 

when i create new Widget , label can`t display on lcd.

if i mask "gwinLabelSetAttribute(ghLabelLcdBlTime, 100, ""); " ,the label can show .  

GWidgetInit wi; // Apply some default values for GWIN    
wi.g.show = TRUE;    // Create the IP label    
wi.g.width = 200; 
wi.g.height = 20; 
wi.g.x = 10, 
wi.g.y = 100;    
wi.text = "";    
ghLabelLcdBlTime = gwinLabelCreate(0, &wi); 
gwinLabelSetAttribute(ghLabelLcdBlTime, 100, "");   


Share this post

Link to post
Share on other sites

create all the widgets during startup/initialization .

    ghTabset            = gwinTabsetCreate(0, &wi, GWIN_TABSET_BORDER);
    ghPgSetting            = gwinTabsetAddTab(ghTabset, "tab1", FALSE);
    ghPgVersion            = gwinTabsetAddTab(ghTabset, "tab2", FALSE);

I want to show tab1 only, tab2 hide. but can`t work use follow code.


Share this post

Link to post
Share on other sites
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...