React when a scrollbar activates - apache-flex

I have a TextInput in a container. I need the horizontal scrolling capabilities of the container so that when the textInput is to big it allows me to scroll to see the text on the left and right. The scrollbar track and thumb were set to null so I can see the text.
trackSkin: ClassReference(null);
thumbUpSkin: ClassReference(null);
thumbOverSkin: ClassReference(null);
thumbDownSkin: ClassReference(null);
thumbSkin: ClassReference(null);
Now I want to listen to an event or watch a property that changes when the horizontal scrollbar activates. Then I would like to set a padding on the container or left and right property on the text input so that the left and right arrows do not get in the way of the user to see the first and last characters.
Thanks

Before adding listeners and accessing the HScrollBar of the Scroller, you may find this setting/variable of some use: measuredSizeIncludesScrollBars
From the API: (Please forgive the terrible formatting)
If true, the Scroller's measured size includes the space required for the visible scroll bars, otherwise the Scroller's measured size depends only on its viewport.
Components like TextArea, which "reflow" their contents to fit the available width or height may use this property to stabilize their measured size. By default a TextArea's is defined by its widthInChars and heightInChars properties and in many applications it's preferable for the measured size to remain constant, event when scroll bars are displayed by the TextArea skin's Scroller.
In components where the content does not reflow, like a typical List's items, the default behavior is preferable because it makes it less likely that the component's content will be obscured by a scroll bar.
In the event this doesn't work, I would probably add an event listener attached to the lifecycle of the Scroller. During that event handling, I would check to see if the Scrollbar was null or not. If it wasn't, I would store it off to the side, but not before adding a listener to its "show" and "hide" event. That way, you can kick off whatever you need to whenever the scrollbar changes its state.

Related

Getting QScrollArea to resize its child widget immediately

I have a QScrollArea (we'll call it myContainer) that contains and scrolls a child view (we'll call it myChildWidget). All works almost fine - when I change the height of myChildWidget dynamically in response to something, if the height exceeds that of myContainer (the QScrollArea), a vertical scroll bar pops into view, effectively narrowing myChildWidget since I've set it to resize its child using:
myContainer->setWidgetResizable(true);
The problem is that myChildWidget is not actually resized until later, rather than right when I set its new height or try resizing myContainer, so I can't do certain things depending on its new width without subclassing and putting in a whole bunch of extra code. Surely there's something I can call to get the QScrollArea to auto-resize its child right away, right? I can use:
QCoreApplication::processEvents();
but the problem with that is that it causes the widgets to flash and redraw when I'm not done setting things up. I've tried update(), updateGeometry(), and adjustSize(), both on the container and its child, and none work. Anything I'm missing? Thanks for any help.

iPhone Autolayout UIText suffocation

I know I can fix this programmatically and I know I could set the text to tighten / scale but I would like to know how to get this text to extend organically to a third line on small screens. How can I accomplish that?
There are a couple of things you need to take care of before your label grows:
Make sure the 'number of lines' field in the attributes inspector is set to zero. Setting it zero allows the label to grow depending upon the content it has.
If the label is in a container view, make sure you haven't specified the height constraint explicitly on the container view. Since the container view should generate its height from its subviews and the subviews will generate their height from the content they have. Its sort of a chain process that goes on if you have a deeper hierarchy.
Make sure there is no sibling view to the container view with an explicit height that might cause your container view to shrink while maintaining its own height. This point may also apply even if your label is not within some container view.
In the image below, the container view(gray one) is bound from three sides allowing it to grow from the bottom.
Below image shows the constraints applied to the content views of the container. The container is driving its height from its content views.
Below I have increased the text of the label from a single line to three lines. At this point the label tries to expand horizontally but since the container view is bind with the super view on both sides the label has only one direction left to increase itself. It increases downwards pushing the textfield and button down and since the button is tied with the bottom of the container view it pulls the container view increasing its height.

drag and drop in Canvas

I'm doing an application in flex where I draw different sprites inside a canvas. Depending of the dimensions, scrollbars can be appear. I would like to move the "image" with the movement of the mouse as you can see at the Adobe Reader when you are reading a document with zoom (hand mouse icon). In this way, you dont have to touch the scrollbar.
I'm start trying with drag and drop properties of the canvas, setting the position of the scrollbar according with the movement of the mouse but that is not as I expect.
Any ideas or suggestions?
Thanks in advance.
Recipe:
Listen for the mouseMove (MouseEvent.MOUSE_MOVE) event on the canvas
In event listener, examine event.localX, event.localY
Based on those values and the canvas's width and height, set the canvas's horizontalScrollPosition and verticalScrollPosition accordingly
Hope this helps.
What you can do is, change the position of the scrollbar , when the mouse reaches the last 20 pixels on the left or the right, or the top and bottom.
What you would really need to do is, have a mouseMove listener on the whole application, and when the mouse is within the end ranges of any of the sides, you can use the scroll.scrollTo function to move the scrollbars.

Draggable scrolling. How to scroll while dragging?

When I was starting to drag any element, mouse wheel scrolling is turned off, how to scroll while dragging?
I'm newbie here, so I can't insert a picture, here's a link http://i.stack.imgur.com/4tp69.gif
Hm... I would say it is because the scrolling is caught by the dragged element, as it is on top of the VGroup. So - I guess the solution would be to listen to scrolling event in the dragged element and send that to the VGroup / something that will handle the drag'n'scrolling of the VGroup.
Also - I am not sure, but when you are dragging, the VGroup might no more be specified as the dragged element's parent - so, just add a realParent reference or whatever so you can always access it.

Updatepanel height remaining largest size after update

After almost 4 years of use, one of my testers noticed something strange with my update panels.
Let's say I have a display mode and it takes 100 pixels in height. The user then switches to edit mode and the updatepanel updates. The window is now 500 pixels in height. The user clicks save and it turns back to display mode, which is only 100 pixels.
Now the dom only takes 100 pixels, but there still is a scrollbar all the way to 500 pixels. If the user shrinks the screen down to 100 pixels, he/she will still see a scrollbar, despite the fact that there's nothing down there anymore.
What the hell is causing this and how do I fix it? It's like the updatepanel doesn't tell the window it doesn't need all that height anymore.
Sounds to me like your control maybe using visibility="visible|hidden" instead of display:"none|block".
Use IE Dev Toolbar or Firebug to see what the DOM structure is during your page state.
It also may just be that your edit mode is too big for its fixed height container. Try not constrain the outermost container so it can grow with the dynamically changing internal content.
The visibility property determines
whether a given element is visible or
not (visibility="visible|hidden").
However, when visibility is set to
hidden, the element being hidden still
occupies its same place in the layout
of the page.
CSS Properties: Display vs. Visibility

Resources