madhu Posted October 6, 2016 Report Posted October 6, 2016 Hi, How to draw a graph inside a container..?
Joel Bodenmann Posted October 6, 2016 Report Posted October 6, 2016 You place the graph widget into the container - just as you would with any other widget/container combination: // Create the container wi.g.y = 10; wi.g.x = 10; wi.g.width = 320; wi.g.height = 240; wi.text = "Container"; ghContainer = gwinContainerCreate(0, &wi, GWIN_CONTAINER_BORDER); // Create the graph wi.g.x = 10; wi.g.y = 10; wi.g.width = 300; wi.g.height = 200; wi.g.parent = ghContainer; // Specify the parent container ghGraph = gwinGraphCreate(0, &wi.g);
madhu Posted October 6, 2016 Author Report Posted October 6, 2016 I tried above code im not seeing anything just blank screen is coming..
Joel Bodenmann Posted October 6, 2016 Report Posted October 6, 2016 Can you please provide us with an archive that contains a minimum-test case example that allows us to reproduce the problem?
91321146 Posted October 15, 2016 Report Posted October 15, 2016 Yes.the screen has nothing to show!Madhuri is right
Joel Bodenmann Posted October 17, 2016 Report Posted October 17, 2016 We are happy to help resolving or fixing any issue. But as mentioned in the previous post we require you to provide us with a minimal-test case that allows us to reproduce the problem.
91321146 Posted October 21, 2016 Report Posted October 21, 2016 Hi Look at this code ... Its the widget example of UGFX that i add graph to containerpage0 ... But when i click on change page the screen is white!!!!! all of the pre-conditions is adjusted too.
inmarket Posted October 21, 2016 Report Posted October 21, 2016 The thing to remember about the graph window is that it doesn't store state. If the screen gets redrawn the user needs to redraw the graph as the default redraw action for the graph is just to fill with the background color waiting for the user to redraw the graph itself. So, when the container the graph is on gets redrawn, the container then tells its children to redraw, the graph because it does not retain state just clears its background which leads to what you have seen. To solve your problem you need to redraw your graph after your container becomes visible. Another little gotcha is that window redrawing on ugfx often occurs on the delayed timer thread. The solution is to put a gfxYield call after making the container visible then redraw the graph after the gfxYield. The reason the graph does not maintain state is because to do so in a general manner would take too much ram. The application either already has the state or it will be redrawing new state (for a moving graph).
91321146 Posted October 22, 2016 Report Posted October 22, 2016 (edited) Hi dear.. What is gfxaYield? I could not notice! May you give an example with gfxYield? Of course I use keel rtx (os) Thanks if answer Edited October 22, 2016 by 91321146
Joel Bodenmann Posted October 22, 2016 Report Posted October 22, 2016 The function gfxYield() is a function provided by the GOS module. Yielding is a generic concept of operating systems. A thread can give up his remaining time slice of processor time to other threads by calling gfxYield(). The detailed behavior depends on the underlying system that is being used. API documentation of gfxYield(): http://api.ugfx.io/group___g_o_s.html#ga48e13e354721ffac812c59d360956556
91321146 Posted October 22, 2016 Report Posted October 22, 2016 May you give an example with gfxYield in graph redrawing ? Of course I use keel rtx (os) Thanks if answer
91321146 Posted October 22, 2016 Report Posted October 22, 2016 Is it necessary to use gfxYield if I redraw graph?
Joel Bodenmann Posted October 22, 2016 Report Posted October 22, 2016 As @inmarket explained: The reason you get an empty box is because a graph is a window, not a widget. As explained in the documentation for the widgets, once of the differences between a window and a widget is that a widget is always able to redraw it self, whereas a windows doesn't know how to redraw itself. The graph is a window and not a widget because it is either too complex or too expensive for the GWIN module to buffer the graph data. The thing about gfxYield() that @inmarket mentioned is only some additional background information. Solely using gfxYield() will not resolve your "problem". To summarize: A graph is not able to redraw itself because it doesn't know the contents that it is displaying. This is a design decision that was made to keep everything small, fast & simple. It is up to the user (you) to redraw the graph when necessary. If you have some very specific needs, it is always possible to implement a custom widget based on the graph window. In that custom widget you can store the data you want to display and do other things that are specific to your application.
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