Jump to content

How to create a new Widget with a button?


Recommended Posts

hi:

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!

 

tks

 

 

Link to comment
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.

Link to comment
Share on other sites

tks!

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    
gwinWidgetClearInit(&wi);    
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 = "192.168.1.42";    
ghLabelLcdBlTime = gwinLabelCreate(0, &wi); 
gwinLabelSetAttribute(ghLabelLcdBlTime, 100, "");   

 

Link to comment
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.

gwinShow(ghPgSetting);
gwinHide(ghPgVersion);

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...