I need to display a virtually infinite scrollabe list of interactive widgets and add/remove them as necessary when new data is added or the user scrolls into an uncached area.
A TreeView (as asked about here) is no option, because, I need full Widgets as items (composed of standard widgets with multiple actions etc, but CellRenderer isn't for this)
Worse, I don't know my widgets' height in advance (not much variance though), so using a VBox might cause jumpiness.
Using the scrollbar should still feel as if the list was finite (i.e. updated only after scrolling has finished so the scrollbutton doesn't jump away from your mouse), and when resizing the window and the layout of the windows is updated, the scroll position shouldn't change too much (the focused widget should stay where it is, unless of course the focused widget was scrolled away…).
What's the best way to do this? Maybe even a library that just sends me signals when a new widget needs to be added?
Or could the ListView be coerced to do this in a not-too-nasty way? (i.e. draw on an offscreen buffer, copy that into the cell using CellRenderer, relay mouse/keyboard events to the actual widget?)
If it is a infinity list, then you should not try to achieve anything with a scrollbar - this is only meant for finite lists.
My suggestion is to use an overlay with 2 buttons
+------------+
| UP ARROW |
+------------+
| ITEM N |
| ITEM N+1 |
| ITEM N+2 |
+------------+
| DOWN ARROW |
+------------+
For the list between the buttons, you will probably have to implement a custom container widget yourself.
I suggest to buffer n (>=2) widgets/items in each direction in advance.
Not really related to custom containers, but custom widgets - a starting point
http://zetcode.com/tutorials/cairographicstutorial/customgtkwidget/
http://gnomejournal.org/article/34/writing-a-widget-using-cairo-and-gtk28
http://old.nabble.com/Custom-container-%2B-Child-type-with-interface-td26863728.html
Related
I have a RichEditControl with a given width and height. It's usually a one page document, but sometimes documents can get longer than that. When that happens, the RichEditControl adds a page to it underneath the current one, and a vertical scroll bar to navigate both.
Is there a way to make the document show only one page at a time, so I see Page 1 by default until I write enough to get a page jump, and then I only see page 2 in screen?
This would probably require some sort of pagination, which I imagine is not built-in, so my derived question is:
Since there is no ability to re-size control based on content size (source), would it be better to just count the number of pages, and make the RichEditControl height a multiple of that number? Since this is all inside a bigger ScrollViewer, I'm trying to avoid more inner scroll bars.
I have created a Window and then, created 50 buttons on this Window but I can only see 10 buttons on my window. Rest are out of view since I am not able to scroll the window down.
I have added auto scroll to window by adding
WS_VSCROLL | WS_HSCROLL | ES_AUTOVSCROLL | ES_AUTOHSCROLL
to Window Style parameter of CreateWindowEx function. By doing this, I can see a scroll on the window but this scroll is not movable.
What is the possible and simple solution to add a auto scroll to window in order to see all the 50 buttons in such a situation.
you will have to handle WM_VSCROLLand WM_HSCROLL messages.
You must handle the button messages of your scrollbar. You enabled the scrollbar by using WS_VSCROLL | WS_HSCROLL adn you already noted that you can see them. However using ES_AUTOVSCROLL | ES_AUTOHSCROLL doesn't magically mean that the window will scroll. These flags are for edit boxes, so they automatically scroll when characters are added. Your window doesn't recognize these.
So what you must do is to write some code in your message handler when the user clicks the buttons on the scrollbar, to move the window around on your own.
Since using WinAPI directly is not exactly easy, I would recommend to use a GUI library like wxWidgets or QT, which will reduce errors and make your life easier, as there are already a lot features implemented which you might use.
If you insist on WinAPI for whatever reason, you must probably write a lot of code on your own..
Being new to silverlight I'm struggling to 'get going' with the following.
Basically I wish to create some form of grid like control (custom or user?).
The idea is similar to that of a planner. Along the top are times (set intervals). Downwards are subjects. Then over the grid like background rectangles (or something) indicate when the subject is planned for.
The actual design of the above is not the issue. i.e. a grid with ractangles overlaid. But my issue is I wish this grid to be scrolled up and down (with bounds fixing the top and bottom when the subject lines start and end). And also the grid to be scrolled left and right (with bounds fixing how far left and right it can scroll, current time & 3 days into future).
Based on the above needs, I don't wish to create a control which is very large, and just dragged into view (unless this is the only way?) but instead show the grid at a current time and when dragged dynamically load the next few hours worth of content, possibly with a few hours buffer.
The appearance I am seeking is it looking like it is one massive control, but truely its not, its dynamic.
Does this make sense? Am I worrying about nothing? Should I create a massive grid well into the future and then just handle the load of data dynamically over the top? Its just my concern if I want a grid 3 month into the future this would be massive and a waste of memory.
I'm struggling to find examples on the net, but feel this maybe to do with me not knowing what to search for. This isn't about getting a detailed answer and someone doing it for me, but instead about guidance pointing me in the right direction.
Many thanks
About the up-down scroll: you can simply put a grid containing your data in a ScrollViewer control - this will handle all the scrolling for you. Another solution would be using a listbox control - this is better if you use MVVM. You can bind it to a data source and set as data template a custom control.
For the left-right scroll. I'm thinking you could use gestures for this. Like - catch left-to-right and right-to-left flicks and change the data in your grid / listbox according to the gesture's direction. You could also place two buttons at the top of the grid to handle scrolling from one day to the other (just like in the calendar controls: gestures + buttons).
I have an application that will have a dashboard like interface for the main screen, and I need to display a list of recent items in the top left of the screen... each item view will be a fairly tall item displaying quite a bit of data... I want to only display the items that will fit on the screen in the area that the control is in... I don't want to have a scroll bar, and I don't want an item to be cut off partially...
Is there a simple way to do this?
If you know heights of your items, you can always go through them and see if they fit into "ActualHeight" of the main screen. Using this approach you will have to track size changes from main screen and your "recent item" (if it's interactive).
The easier way would be to write a custom panel, and let it measure/arrange its children according to your rules. This way you will not have to track size changes...
A client has asked for a display to flick over like an airport display screen, ie each row flicks over when information changes.
I am not sure which is the best control to use, or the method of getting each row to transform one after the other.
any suggestions woul b gratfully accepted
John
Here's what I would do in general concept..
Make a regular panel of, say 50px high. (This is arbitrary but this panel just holds the size in place so the control doesn't shrink with its contents.)
Create a panel inside that one that will be the 'animated' panel.
When it's time for information to animate, create a storyboard that uses a transformation to "stretch" the height down to 0, change the content to the updated information, then tranform stretch the height back to 50px. This will create the illusion that the panel is flipping over.
If you make this a user control, then you could simply add however many "rows" you needed of this control to a StackPanel to make your screen.
The best way of representing this effect easily is to randomize the text during the change.
Patrick Long implemented this effect as a custom animation here