dragonzhang Posted April 8, 2018 Report Share Posted April 8, 2018 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 More sharing options...
Joel Bodenmann Posted April 8, 2018 Report Share Posted April 8, 2018 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 More sharing options...
dragonzhang Posted April 8, 2018 Author Report Share Posted April 8, 2018 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 More sharing options...
dragonzhang Posted April 8, 2018 Author Report Share Posted April 8, 2018 I 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 More sharing options...
Joel Bodenmann Posted April 9, 2018 Report Share Posted April 9, 2018 When using the tabset widget you should use the tabset widget high level API. There's gwinTabsetSetTab() for that. There are more goodies that you can find in the API documentation. 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