Hi i am using a wxScrolledWindow to show a number of elements. Let's say I have 20 elements in the scrollwindow. Now when the user reaches the end of the list(through scrolling upwards) the scrolling should start again from the top, that is it should not stop when reaching to the end. So lets say i have 20 buttons each having labels like Button1, Button2, ...(upto), Button20. Now when the user scrolls through them and reaches Button20 then typically the scrolling stops but I want that the scrolling should continue and again Button1 should come next, then Button2, ...Button20 . And then the user can continue this process as many times as he/she wants. Similarly for scrolling in the opposite direction also. So in this case lets say the user is at the top of the scrolling list and he/she starts scrolling in the downward direction then typically there is no scrolling but what i want is that the scrolling should continue and Button20 then Button19 should be made visible and so on. Is this possible in wxWidgets? Is there any style of wxScrollWindow that allows this self wrapping kind of behavior.
Reasons for having this kind of scroll behavior:
- I want this in some of my widgets. This reason is for fun learning/demonstrating purposes. That is by writing such a widget I would learn/improve my wxWidgets skill.
- I have a huge list of elements, say a std::setstd::string of 2000. Now if i create a wxButton for each of these 2000 elements and insert that button into the wxScrollwindow then the program is taking a lot of memory. So I want to customize how scrolling works for a large number of elements. This is the design that I am thinking of:
Step 1: Out of the 2000 elements only 20 or 30 elements(wxbuttons) are inserted into the wxScrolledWindow.
Step 2: Out of these 20 or 30 elements only a fixed number say 10 are made to be actually visible on the wxScrollWindow.
Step 3: Then when the user starts scrolling downwards and then the next incoming(11th) element that just becomes visible will get the string value from the next element in the std::set. So we keep track of the element that is just made visible and which has gone out of the visible part of the scrollwindow. And then whenever the user scrolls downwards we just change the label of the next incoming widgets.
So this way the memory consumption should be reduced. Also, is there any other way to handle this situation when we have a large number of elements?
Aucun commentaire:
Enregistrer un commentaire