Get image Scroll bar position value

How to get an image component scrollbar position value in flex.
I have an image component in my application, when i scroll the horizontal scrollbar
i need the current scrolled position. How to get the scrolled position in an image component.
Kindly help in this issue.
Rajkumar.

Are you sure you want to use setOnScroll to listen to scroll events rather than set the value of the scroll bar position via the tableView.scrollTo api (which I would recommend) or the scrollBar.setValue() api?
for (Node n: table.lookupAll(".scroll-bar")) {
  if (n instanceof ScrollBar) {
    ScrollBar bar = (ScrollBar) n;
    System.out.println(bar.getOrientation() + ": range " + bar.getMin() + " => " + bar.getMax() + ", value " + bar.getValue());
      if (bar.getOrientation().equals(Orientation.VERTICAL)) {
      bar.setValue(0.5);
}If you did really, really want to use setOnScroll, then you could do something like this:
Node flow = table.lookup("VirtualFlow");
if (flow != null) {
  final EventHandler<? super ScrollEvent> originalScrollHandler = flow.getOnScroll();
  flow.setOnScroll(new EventHandler<ScrollEvent>() {
    @Override public void handle(ScrollEvent event) {
      System.out.println(event);
      originalScrollHandler.handle(event);
}  Though you would be better off just using an eventfilter rather than using the strange lookup and setOnScroll chaining method in the above code.
table.addEventFilter(ScrollEvent.ANY, new EventHandler<ScrollEvent>() {
  @Override public void handle(ScrollEvent event) {
    System.out.println(event);
    // uncomment if you don't want the default table scroll events processing to take effect.
    //event.consume();
});

Similar Messages

  • When and How to get the Text.ScrollPos value of a String control when scroll bar position changed

    Hi, 
    I'm working on a feature triggered by scroll bar position of a string control changed.
    But I could not find a good way to catch the scroll bar position changed event, 
    the scroll bar is controlled manually by mouse down → mouse move → mouse up, I want the get the Text.ScrollPos value when user mouse up, and compare with the maximum value.
    But the problem is,  mouse up on the scroll bar could not trigger String: Mouse up event!
    So I have to get the Text.ScrollPos continuously in the background in Timeout event, but I think it’s not efficient.
    Do you have any better idea on when to get the correct destination value of Text.ScrollPos?
    I plan to store the value of Text.ScrollPos in the bottom(maximum value) in a shift register, then compare the current Text.ScrollPos value with the max one.
    If it comes close to the bottom(90%~100% of the maximum value), then the close to bottom LED will turn on.
    Attachments:
    scroll bar pos changed.vi ‏15 KB

    Hello Cecilia,
    I don't think there is any build-in event for this.
    One solution would be to create your own user event at the initialisation of you main and launch a thread which is going to be pulling the value of your scrollbar position:
    Then you can build your main as if they were a scrollbar move event.
    And dont forget to close the thread and destroy the event at the end.
    Hope it helps.
    Attachments:
    Scrollbar event.PNG ‏10 KB

  • How to get a scroll bar for nodes?

    How to get the scroll bar to work with the javafx.scene.layout.container.
    I tried putting in one but the SwingScrollPane requires SwingComponent.
    How do I put my fx nodes inside it.
    I could not find any way to cast the node objects into SwingComponent.

    Hi,
    Here's a little sample with custom scrollNode
    You must modify the code but you can start with it.
    * ScrollNode.fx
    * Created on 14 mars 2009, 14:53:55
    package fxtests;
    import fxtests.ScrollNode;
    import java.lang.Object;
    import javafx.ext.swing.SwingSlider;
    import javafx.scene.CustomNode;
    import javafx.scene.Group;
    import javafx.scene.Node;
    import javafx.scene.paint.Color;
    import javafx.scene.paint.LinearGradient;
    import javafx.scene.paint.Stop;
    import javafx.scene.Scene;
    import javafx.scene.shape.Rectangle;
    import javafx.scene.text.Text;
    import javafx.stage.Stage;
    import javafx.scene.text.TextOrigin;
    * @author Alex
    public class ScrollNode extends CustomNode {
        public-init var node: Node;
        public-init var nodeWidth: Number;
        public-init var nodeHeight: Number;
        public var scrollHeight = 20;
        public var width = 200;
        public var height = 200;
        public var posX: Integer = 0 on replace {
            node.translateX = -posX
        public var posY: Integer =
        nodeWidth - width as Integer on replace {
            node.translateY = posY-(nodeWidth - width)
        public override function create(): Node {
            return Group {
                content: [
                    SwingSlider {
                        value: bind posX with inverse
                        minimum: 0
                        maximum: nodeWidth - width as Integer
                        width: width
                        height: 20
                        translateX: 20
                        vertical: false;
                    SwingSlider {
                        value: bind posY with inverse
                        minimum: 0
                        maximum: nodeHeight - height as Integer
                        height: height
                        width: 20
                        translateY: 20
                        vertical: true
                    Group {
                        translateX: scrollHeight
                        translateY: scrollHeight
                        clip: Rectangle {
                            width: width
                            height: height
                        content: node
                    Text {
                        translateX: scrollHeight+10
                        translateY: scrollHeight+10
                        textOrigin: TextOrigin.TOP
                        content: bind "node position: {node.translateX}, {node.translateY}"
    function run() {
        Stage {
            title: "ScrollNode"
            scene: Scene {
                width: 400
                height: 400
                content: [
                    ScrollNode {
                        width: 200
                        height: 200
                        nodeHeight: 500
                        nodeWidth: 500
                        node: Rectangle {
                            width: 500
                            height: 500
                            fill: LinearGradient {
                                startX: 0.0
                                startY: 0.0
                                endX: 1.0
                                endY: 1.0
                                stops: [
                                    Stop {
                                        color: Color.WHITE
                                        offset: 0.0
                                    Stop {
                                        color: Color.BLACK
                                        offset: 1.0
    }

  • How to get Auto scroll bar in a JSP?

    Hi Gurus,
    I have created a custom jsp page in a B2B application. How to get the auto scroll bar when page is exceeded than it can display?
    Is there any specific tag or div which is to be included to get this scroll bar?
    Thanks a lot in advance!!
    Regards,
    Lakshman.

    Hi Lakshman,
    You can include it in stylsheet and then use that class in your <body> or "div"  tag.
    the CSS command is
    overflow:auto;
    you can use like
    <body style="overflow: auto;"> or -- div style="overflow: auto;" 
    You can declare class in ".css" file
    #c1
    .c1
    <body id="c1>> or <div id="c1">
    <body class="c1>> or <div class="c1">
    You can use either "class" or "id" by adding it to "CSS" file and the use it to any JSP file or by direct aditing "Style" attirbute in tag.
    so when your content is longer then your screen browser will display scroll bar automatically.
    I hope this will help you.
    Thanks and Regards.
    eCommerce Developer
    Edited by: Ecommerce Developer on Jul 9, 2009 5:58 PM
    Edited by: Ecommerce Developer on Jul 9, 2009 5:59 PM

  • I just upgraded from snow leopard v10.6.8 to os x mountain lion and my scroll bar has disappeared on all my applications on the internet. does anyone know a patch to get the scroll bar to work.

    i just upgraded from snow leopard v10.6.8 to os x mountain lion and my scroll bar has disappeared on all my applications on the internet. does anyone know a patch to get the scroll bar to work.

    Open General preferences in System Preferences. You can set the desired scrollbar behavior there.

  • How to get a scroll bar to the applications popup by default?

    How to get a scroll bar to the applications popup by default when clicked the applications folder from the dock? If I have so many applications that they do not fit in the default area, I have to find out myselft that I have to scroll the content before the scroll bar appears. This leads to "where is my missing applications questions" by the novice users with Mountain Lion.

    System Preferences > General > Show scroll bars.
    Click the button by the side of "Always".
    Best.

  • How Do I Get back scroll bar arrows Back

    Is there a way to get back scroll bar arrows back in OS 10.8.4  ? Thats all.

    Newer systems might also provide different functionality instead of just more.
    There are many cases where Apple has changed things (taken away here, given something different there) and with good results.
    However I agree with you bernuli:  (Mountain) Lion has been a disaster in many ways.  At least to me.  I produce information and want to be productive with precision and speed.  I know how to spell and I know what I am looking at.  So I want all animations OFF, all spelling checking OFF, all horrible yellow "tooltips" OFF and so on.
    Just today I have finally switched, after more than two years ago buying a machine specially for Lion and figuring out how to live with it.  I can still feel my blood pressure rise, despite a lot of tweaking in those two years.  I want those little arrows back (using TinkerTool I had both of them at the top and both at the bottom!)  The keyboard arrows are NOT a replacement.
    You will be assimilated into the touch-interface world, resistance is futile.

  • HT1338 How do you consistently get the scroll bar on the right side of the page

    How do you consistently get the scroll bar on the right side of the page.

    Go into System Preferences, select General and set "Show scroll bars" to "Always".

  • Custom Horizontal Scroll Bar position on File Open

    Fellow Forum Members,
    I have a lot of PDF files that I want to open in a special way. I want them to open at 150% ZOOM and this was easy enough to setup in the PREFERENCES window.
    However, what is proving to be a big problem is changing how the horizontal scroll bar has a default position all the way to the left. My objective is to have the horizontal scroll bar positioned all the way to the right and at a 150% everytime I open a PDF file.
    The Preferences window doesn't seem to have a horizontal scroll bar position on open setting. Can anyone help me out and tell me how such a custom setting is possible with Acrobat 9 Extended? Any help will be greatly appreciated. Thanks.

    Does anyone have any ideas?

  • Does anybody know how to get a scroll bar for a long list of podcasts when selcting some for sync? Thanks

    Does anybody know how to get a scroll bar for a long list of podcasts when selcting some for sync? Thanks

    Hi lbadek
    I can help with this please send us an email using the contact the mods link in my proifle and we will investigated from there.
    Thanks
    Stuart
    BTCare Community Mod
    If we have asked you to email us with your details, please make sure you are logged in to the forum, otherwise you will not be able to see our ‘Contact Us’ link within our profiles.
    We are sorry that we are unable to deal with service/account queries via the private message(PM) function so please don't PM your account info, we need to deal with this via our email account :-)

  • Can I get my scroll bars back?

    After one day of using the new Lion scroll system, my wrist is killing me.  Is there a way to get the scroll bars back in Lion?

    You can check show always in systPref in the general pane as leroy.. say ..

  • How to get transparency scroll bar to view background image of canvas.

    HI, 
    How to get transparency to path in canvas to view background image in canvas using scroll bar control.?
    This is my present output:
    My Xaml Code:
    <Grid Height="auto" Name="grid1">
    <TabControl Background="Bisque">
    <TabItem Header="Tools">
    <Grid Height="1000" Width="1000" Name="grid">
    <Border BorderThickness="0.2" BorderBrush="Black" Height="820" Width="820" ClipToBounds="True" Margin="90,99,90,81"></Border>
    <Grid>
    <Button Content="Original Size" Height="23" Name="btn_Original" Width="75" Click="btnOriginalSizePosition" Margin="4,4,921,973" />
    <TextBox Height="20" HorizontalAlignment="Left" Margin="62,49,0,0" x:Name="txtNoOfZones" VerticalAlignment="Top" Width="49"
    MaxLength="2" PreviewTextInput="txtNoOfZones_PreviewTextInput"/>
    <TextBox Height="20" HorizontalAlignment="Right" Margin="0,71,890,0" x:Name="txtSec" VerticalAlignment="Top" Width="49" PreviewTextInput="txtSec_PreviewTextInput" MaxLength="3"/>
    <Button Content="OK" Height="32" HorizontalAlignment="Left" Margin="117,59,0,0" Name="btnNoOfZones" VerticalAlignment="Top" Width="39" Click="btnNoOfZones_Click" />
    <Label Content="Zone Number selected :" Height="28" HorizontalAlignment="Right" Margin="0,0,451,0" Name="lblZone" VerticalAlignment="Top" />
    <Label Content="Sector Number in selected Zone :" Height="28" HorizontalAlignment="Right" Margin="364,22,451,0" Name="lblSector" VerticalAlignment="Top" />
    <Label Content="Filled Color applied in selected sector :" Height="28" HorizontalAlignment="Right" Margin="336,44,451,0" Name="lblColor" VerticalAlignment="Top" />
    <Label HorizontalAlignment="Left" Margin="569,0,0,0" Name="lblZoneNumber" Height="28" VerticalAlignment="Top" />
    <Label Height="28" HorizontalAlignment="Left" Margin="569,22,0,0" Name="lblSectorNumber" VerticalAlignment="Top" />
    <Label Height="30" HorizontalAlignment="Left" Margin="569,44,0,0" Name="lblFillColor" VerticalAlignment="Top" FontWeight="Bold"/>
    <Label Content="Sectors :" Height="28" HorizontalAlignment="Left" Margin="7,67,0,905" Width="69" />
    <Label Content="Zones :" HorizontalAlignment="Left" Margin="13,44,0,928"/>
    <TextBlock Height="23" HorizontalAlignment="Left" Margin="4,32,0,0" Text="Change No.of Zones, sectors below and click OK button" VerticalAlignment="Top" Width="294" FontFamily="Cambria" FontSize="12" FontStyle="Italic" FontWeight="Bold" />
    <RadioButton Content="Single Sector" Height="16" HorizontalAlignment="Left" Margin="744,24,0,0" Name="rBtnSingleSector" VerticalAlignment="Top" GroupName="Selection"/>
    <RadioButton Content="Sector Zone" Height="16" HorizontalAlignment="Left" Margin="744,44,0,0" Name="rBtnSectorZone" VerticalAlignment="Top" GroupName="Selection"/>
    <RadioButton Content="Circular Zone" Height="16" HorizontalAlignment="Left" Margin="744,64,0,0" Name="rBtnCircularZone" VerticalAlignment="Top" GroupName="Selection"/>
    <RadioButton Content="Panning" Height="24" HorizontalAlignment="Left" Margin="744,4,0,0" Name="rBtnPanning" VerticalAlignment="Top" Width="74" GroupName="Selection"/>
    <Border x:Name="clipBorder" BorderBrush="Black" BorderThickness="0" ClipToBounds="True" Height="810" Width="810" Margin="95,104,95,86" CornerRadius="10">
    <Canvas x:Name="CanvasPanel" Height="800" Width="800" Background="Transparent" ClipToBounds="True"></Canvas>
    </Border>
    <RadioButton Content="Random Color" HorizontalAlignment="Left" Margin="868,5,0,979" Name="rdBtnRandomColor" GroupName="rdbtnGroupFillColor"/>
    <RadioButton Content="Red Color" Height="16" HorizontalAlignment="Left" Margin="868,24,0,0" Name="rdBtnRedColor" VerticalAlignment="Top" GroupName="rdbtnGroupFillColor" Foreground="#FFF81010" FontWeight="Bold" />
    <RadioButton Content="Green Color" Height="16" HorizontalAlignment="Left" Margin="868,44,0,0" Name="rdBtnGreenColor" VerticalAlignment="Top" GroupName="rdbtnGroupFillColor" Foreground="#FF175F17" FontWeight="Bold" />
    <RadioButton Content="Adjacent" Height="16" HorizontalAlignment="Left" Margin="435,81,0,0" Name="rdBtnAdjacent" VerticalAlignment="Top" GroupName="Selection" />
    </Grid>
    </Grid>
    </TabItem>
    <TabItem Header="Change Background">
    <Grid Height="1000" VerticalAlignment="Top" Background="Bisque">
    <Button Height="70" Width="70" Margin="6,1,892,929" Name="btnBrowseImage" Click="btnAll">
    <Image x:Name="browseIcon" Source="D:\WPF\Projects\TabControlVRI_18_12_2014\Images\img.png" MouseLeftButtonDown="Image_MouseLeftButtonDown_1"/>
    </Button>
    <Button Height="70" Width="70" Margin="92,1,806,929" Name="btnCenterPoint" Click="btnAll">
    <Image x:Name="centerIcon" Source="D:\WPF\Projects\TabControlVRI_18_12_2014\Images\center.jpg" Width="54" Height="48" />
    </Button>
    <Button Height="70" Width="70" Margin="179,1,719,929" Click="btnAll">
    <Image x:Name="boundaryIcon" Source="D:\WPF\Projects\TabControlVRI_18_12_2014\Images\Path_Simple.png" Height="44" Width="49" />
    </Button>
    <Image Name="imgBackground" Height="800" Width="800" MouseLeftButtonDown="imgBackground_MouseLeftButtonDown">
    </Image>
    </Grid>
    </TabItem>
    </TabControl>
    </Grid>
    C# code:
    OpenFileDialog op = new OpenFileDialog();
    ImageBrush ib = new ImageBrush();
    private void Image_MouseLeftButtonDown_1(object sender, RoutedEventArgs e)
    op.Title = "Select a picture";
    op.Filter = "All supported graphics|*.jpg;*.jpeg;*.png|" +
    "JPEG (*.jpg;*.jpeg)|*.jpg;*.jpeg|" +
    "Portable Network Graphic (*.png)|*.png";
    if (op.ShowDialog() == true)
    ib.ImageSource = new BitmapImage(new Uri(op.FileName));
    imgBackground.Source = new BitmapImage(new Uri(op.FileName));
    CanvasPanel.Background = ib;
    Please help me out to get transparency for path in canvas to view background image in canvas.
    The complete code is in below link:
    https://onedrive.live.com/redir?resid=876CFAE94C306176!112&authkey=!AC1sQIYwyoRYT_o&ithint=file%2crar
    Regards,
    Viswa.

    Hi ViswAmmu,
    >>Please help me out to get transparency for path in canvas to view background image in canvas.
    If I'm not misunderstanding, I think you just need to loop through all Canvas.Children and set Opacity property for them:
    private void Image_MouseLeftButtonDown_1(object sender, RoutedEventArgs e)
    //Loop through all children items
    foreach(UIElement v in CanvasPanel.Children)
    v.Opacity = 0;
    op.Title = "Select a picture";
    op.Filter = "All supported graphics|*.jpg;*.jpeg;*.png|" +
    "JPEG (*.jpg;*.jpeg)|*.jpg;*.jpeg|" +
    "Portable Network Graphic (*.png)|*.png";
    if (op.ShowDialog() == true)
    ib.ImageSource = new BitmapImage(new Uri(op.FileName));
    imgBackground.Source = new BitmapImage(new Uri(op.FileName));
    CanvasPanel.Background = ib;
    Screenshot:
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How can I get the scroll bar to go to the top or bottom of the page with a right click command?

    When I right click on the scroll bar nothing happens. I have to spin the mouse wheel repeatedly to get to the top or bottom of the page. I just switched from explorer. I'm used to being able to do this. It's much less time consuming and frustrating. I hope someone can help. Thanks.

    You can hold down the Shift key and left-click the scroll bar to go to that position.
    If you set the Boolean pref <b>middlemouse.scrollbarPosition</b> to "<i>true</i>" (default on Linux) on the <b>about:config</b> page then you can middle-click the scroll bar to go to that position.
    *http://kb.mozillazine.org/middlemouse.scrollbarPosition
    *http://kb.mozillazine.org/ui.scrollToClick

  • How do I get the scroll bars in iCloud Numbers Beta to appear?

    I have been playing around with Numbers iCloud and have a long spreadsheet. The only way I have figured out to make scroll bars appear is to drag on one of the spreadsheet's borders. They appear, then disappear as soon as I get done scrolling. How can I make them stay visible or make them visible in a more elegant way?

    I don't know if you're still working on this, but I finally stumbled onto a solution. I've been having the same problem using iCould Numbers on a PC in Google Chrome. I finally figured out if you 'mouse over' where they're supposed to be, they'll appear. So drag your mouse over near either the edge of that window or where the spreadsheet meets the format panel along the right edge (depends on what you have showing.) The scroll bars will faithfully appear.

  • Problem getting vertical scroll bar in tree

    Hi,
    I am adding nodes to a tree control dynamically. But somehow,
    a vertical scroll bar doesn't appear during the process. I guess,
    somehow, the tree is not able to detect the change in the height,
    hence, is not giving the vertical scroll bar. However, after a node
    has been populated with the sub-nodes, when I close that node and
    re-open it, then the scroll bar appears. I really need to fix it as
    soon as possible. Plz help!
    Thanks in advance,
    Cheree

    Seems like Flex 4 is working fine:
    This is the updated code working on Flex 4.6 using XMLCollection:
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                   xmlns:s="library://ns.adobe.com/flex/spark"
                   xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" applicationComplete="application1_applicationCompleteHandler(event)">
        <fx:Declarations>
            <!-- Place non-visual elements (e.g., services, value objects) here -->
        </fx:Declarations>
        <fx:Script>
            <![CDATA[
                import mx.collections.ArrayCollection;
                import mx.collections.XMLListCollection;
                import mx.controls.Tree;
                import mx.events.FlexEvent;
                import mx.events.TreeEvent;
                [Bindable]
                public var treeData: XMLListCollection=new XMLListCollection();
                private var hasRun: Boolean = false;
                //finalSrcList is the ArrayCollection that has value objects returned from data base by a remote object.
                public function populateTree(event:TreeEvent): void{
                    if (hasRun == false){
                        hasRun = true;
                        var parentNode:XML=event.item as XML;
                        var temp:XML;
                        var i: int;
                        var finalSrcList: ArrayCollection = new ArrayCollection();
                        // Prepare source list
                        for (i=0; i<10; i++){
                            var item = new Object();
                            item.attribute1 = "attribute " + i.toString();
                            item.attribute2 = i.toString();
                            finalSrcList.addItem(item);
                        for(i=0;i<finalSrcList.length;i++){
                            temp= <node label={finalSrcList[i].attribute1} id={finalSrcList[i].attribute2} isBranch="true"/>;
                            event.currentTarget.dataDescriptor.addChildAt(parentNode,temp,0);
                protected function application1_applicationCompleteHandler(event:FlexEvent):void
                    var rootItem: XML;
                    rootItem = <root label="root" id="1000">
                        <node label="level1" id="2000" isBranch="true"/>
                        </root>;                                   
                    treeData.addItem(rootItem);
            ]]>
        </fx:Script>
        <mx:Panel width="600" height="250" paddingBottom="20" paddingLeft="20" paddingRight="20" paddingTop="20"
                  verticalAlign="middle" horizontalAlign="center">
            <s:Label>
    This is using XMLCollection
            </s:Label>
            <mx:Tree id="funcTree" height="100%" width="100%" dataProvider="{treeData}" labelField="@label" showRoot="false"
                     itemOpen="populateTree(event)" />       
        </mx:Panel>                  
    </s:Application>

Maybe you are looking for

  • EHP Installer does not find BI Java system on 2 System server

    Hi folks, I have a 2-node MSCS cluster with a standalone BI 7.0 ABAP system, as well as a standalone BI 7.0 Java system. To be clear, these are seperate systems, with seperate SID's, installed MCOD in one Oracle instance (A neccessity for J2EE Authen

  • Cannot get online

    Hi. Got a new MBP today. (I suppose it is "Late 2009" model?) I could get online and do stuff. Then I started installing some of the basic apps such as Unrarx and Little Snitch. When I installed Little Snitch, the problems started -- I am unable to c

  • TDS Provision - J1INPR - Profit Center in line item 0001 not defined

    HI SAP GURUS, When I am running j1inpr,  error of profit center not defined for line item 0001 is coming. Please help me to resolve the issue CHEERS

  • Search help for a  select options

    Hi , I need to place a search help for a select-options field on my report selection screen. It should work for a z-table field . I can create a search help for the Z-table field , but I do not know how to make it available for the select-options. Th

  • Disable apps (also in metro) windows 8.1 tablet

    Is it possible to disable apps from displaying or starting in Windows 8.1 Pro thru local group policy user. As administrator i want to lock down all settings on a Windows 8.1 tablet for the normal user also that the user can start apps from metro or