Nest scrollviews with exclusive direction - famo.us

I want to nest two scrollviews. The outer one should allow only scrolling in x-drection the inner one only y-direction.
It seems that the MouseSync of the inner scrollview always takes the mouse-event and invokes prevent-default regardless of the direction-settings.
How can such behavior be implemented?

I tried to comment first to see your use case but didn't get a response.
I needed something similar to display a list of customers and their data where to see the next customers info the design wanted to be able to scroll right or left while still being able to scroll up or down for more details on that customer. Now you can just pipe the scrollviews together but that gives an odd effect where when you slide your finger down unless its directly down no left right the whole page swivels around. I ended up using a paginated scroll view for x-direction populated by views that where a standard scrollview in the y-direction. Doing it this way I was able to set a some rules that made the left right transition not kick in till after so many pixel drag in that direction.
The codes here:
https://github.com/vizidrix/famous/blob/master/page-swaper/PageSwaper.js
If that isn't what your looking for let me know your use case.

Related

How to position the content of a CListBox on a non-item boundary?

Not sure if this is possible, but I have two CListBox controls which I need to vertically sync, but the controls may have different amount of data in them as well as each row may be of different heights. I want it such that no matter what is in each control, when I get to the top or bottom of one, I get to the same top or bottom of the other.
To do this right, I need to vertically scroll the items such that they don't necessarily align on an item boundary. Like the following example:
Left side shows the top of row one, the middle shows the top of row two. The right image shows a partial of row 1, which is what I need.
Is this possible, or am I going to have to do a major refactor requiring that I swap the controls out with something else? (definitely not preferable due to potential risk)
Oh, and before anyone asks why it was done like this, the answer is legacy.
I'm still looking into this, but if the control can't be forced to to this, might there be a workaround where I could have some sort of virtual CListBox which I could possibly BitBlt from, or would that entail more work then swapping out controls? Is there a better way?
Perhaps I could encapsulate the control in another window which would be able to have a larger view and clip that view to what I want to see?

Qt / C++ - Scrolling & Wrapping Menu

I want to make a menu that will take an undetermined quantity of labels and spread them out horizontally so that 3 are visible on screen at once. When pressing left/right it will go to the next one, the one that is selected is always in the center of the screen horizontally with the other two on the left/right of the screen.
The problem is that I also want a smooth transition not just a replacement. They need to wrap endlessly.
Not sure where to begin, not finding examples on google.
The concept you are talking about was popularized by Apple under the name "Cover Flow".
There is a widget like that available under a permissive license here: https://code.google.com/p/pictureflow/
I take it you want something a bit simpler (only show three labels, less fancy 3D effect), but I assume this is a good starting point.
Another one is the PathView QML element:
http://qt-project.org/doc/qt-5/qml-qtquick-pathview.html#details
It is even closer to what you like to do, feature-wise. It is also available in Qt4 and there is a tutorial here: http://qt-project.org/doc/qt-4.8/declarative-modelviews-pathview.html

How to determine the content step value of scrollarea

I'm making my own UI from scratch using OpenGL that is why I'm asking this and please don't make any discouragement as this is just a hobby project.
Currently, I'm stuck implementing how this scrollbars really work. In my current implementation, the content scrolls at the wrong step value as well as the thumb, meaning, I set the value manually like 1px step for each of them.
The structure of my scrollbar implementation is describe as follows:
I draw scrollbars i.e the main rectangle where the 3 button lies.
Those 3 buttons are, thumb, buttonBack and buttonNext.
All of them do the basic logic of scrollbars i.e when I click each one of them, they moved. But the whole part(scrollbar) don't know how to scroll contents
So what I did is: I make another object and I call it scrollarea
It has two scrollbars, vertical and horizontal scrollbar.
I made a function called scrollToX and scrollToY which
does what I named to them.
But the step values I set to them are
manually set up.
I try to google some scrollbar, scrollarea, scrollview or whatever you call to that scrollable rectangle thing, but all I see are implementation and I cannot find any guides how to build your own. I have no choice but to look at their implementation. I try my best to comprehend what they did but their implementation of how their whole UI structure is very different to mine, and I cannot find anything useful there.
So I ask again here if anybody can explain me well how to make a properly functional scrollbar.
Most specific things I'm really concerned of are:
How do I determine the thumb step value?
How do I determine the content step value?
All of these depend on your content -
Is it just an image ? If so, you only need to change the offset depending on the size of the image.
Is it a list of values like in Windows explorer ? Then you need to create a data structure first that contains all of it, and shows the content that fits within the window as it scrolls.
OpenGL does not fit into this discussion.

Select underlying objects

Greetings!
I've made a program that lets you draw shapes. All shapes are contained in a vector. What I need help with is; when several shapes are stacked on top of each other, I want to cycle through them, top to bottom, if the user clicks repeatedly. I'm thinking something along the lines of:
Store every object under the mouse location where the user clicked in some sort of container
Keep track of which object was first in queue, and should be last (?) after the next click
Repeat step two until the user clicks somewhere that results in a different queue
This is more of a general programming question, rather than just C++, but any help would be greatly appreciated, and if that answer also provides a pretty solution in C++, all the better!
A popular approach to this is to assign each item a z-order. Items with higher z-order hide items with lower z-order if they overlap. In your case, you would just have to find all items below the cursor and rotate their z-orders when the user clicks.

Coupling an MFC CListCtrl and CTreeCtrl to get a view of the whole tree, not just one node at a time

Consider Windows Explorer (or regedit or similar). To the left side, there is a tree view, and to the right, a list view. In all cases I know of, the contents of the right view reflect the attributes of the selected node from the left pane. This is all well and good... but just not what I want.
The nodes of the tree I want to display have a very few attributes (2-3) associated with each node - a reasonable amount to display horizontally as a row in a table. Rather than waste all that list view space on a single node with very few properties, I would like to have my list view display a table of the whole tree's properties (as the part of the tree currently expanded). So the nth line in the left view (tree) will correspond directly to the nth line in the right view (list/table), and I will get a decent overview of the properties of my tree.
Does anyone know of code that does this? I am guessing that slaving a CListCtrl to a CTreeCtrl would be the way to go, and somehow overriding the vertical scrolling functions so that they are locked together. I'm just not sure that it is possible to lock the scrolls together like this... among other things! All advice gratefully welcomed :-)
You are probably looking for Coumn Tree Control
If you make the list control owner-draw, it would be trivial to line it up with the tree control. However you still have the problem of two scroll bars that need to be synced. Perhaps you could capture the scroll events in one and copy them to the other.
Another option would be to skip the list control and use a header control to define your columns, and just draw the text as you need it.