Forum Stats

  • 3,781,149 Users
  • 2,254,484 Discussions
  • 7,879,596 Comments

Discussions

About veiwport x and y position

639858
639858 Member Posts: 54
edited Sep 17, 2008 9:40AM in Forms
Hello everybody,
i'm using forms 9i. In the Canvas property (i'm using it for stack canvas) i saw View port x and y position grouped in 2 different property 1. Viewport 2. Physical.
i saw the help but unable to find the meaning (difference). can any one please explain it
thanks
rahul.
Tagged:

Best Answer

  • Tony Garabedian
    Tony Garabedian Member Posts: 3,375
    edited Sep 15, 2008 3:43AM Accepted Answer
    On stacked canvases you have the viewport properties.

    Viewport X, Y position

    Specifies the x,y coordinates for the stacked canvas's upper left corner relative to the upper left corner of the window's current content view.

    This mean's the position of the upper left corner of your stacked canvas on top of the content canvas.


    Viewport WIDTH, HEIGHT

    Specifies the width and height of the view for a stacked canvas. The size and position of the view define the part of the canvas that is actually displayed in the window at runtime.

    These properties defines how much of your canvas will be visible without using the scrollbar.


    Viewport X, Y position on Canvas

    Specifies the location of the view's upper left corner relative to the upper left corner of the canvas. The size and location of the viewport define the view; that is, the part of the canvas that is actually visible in the window to which the canvas is assigned.

    This specifies what part of your stacked canvas will the viewport (visibility) will cover.



    You should create a form and play around with these properties and you will understand more clearly.


    Tony
«1

Answers

  • Tony Garabedian
    Tony Garabedian Member Posts: 3,375
    edited Sep 15, 2008 3:43AM Accepted Answer
    On stacked canvases you have the viewport properties.

    Viewport X, Y position

    Specifies the x,y coordinates for the stacked canvas's upper left corner relative to the upper left corner of the window's current content view.

    This mean's the position of the upper left corner of your stacked canvas on top of the content canvas.


    Viewport WIDTH, HEIGHT

    Specifies the width and height of the view for a stacked canvas. The size and position of the view define the part of the canvas that is actually displayed in the window at runtime.

    These properties defines how much of your canvas will be visible without using the scrollbar.


    Viewport X, Y position on Canvas

    Specifies the location of the view's upper left corner relative to the upper left corner of the canvas. The size and location of the viewport define the view; that is, the part of the canvas that is actually visible in the window to which the canvas is assigned.

    This specifies what part of your stacked canvas will the viewport (visibility) will cover.



    You should create a form and play around with these properties and you will understand more clearly.


    Tony
  • 639858
    639858 Member Posts: 54
    Thank you once again.
  • 611407
    611407 Member Posts: 418
    Viewport X, Y position

    Specifies the x,y coordinates for the stacked canvas's upper left corner relative to the upper left >corner of the window's current content view.

    This mean's the position of the upper left corner of your stacked canvas on top of the content >canvas.
    This is incorrect. The properties do exactly what they say they do - they specify the position of the Viewport. For a demonstration, add a new stacked canvas to a canvas then put a button in the middle of it and resize the viewport around the button, so that it is only sightly larger than the button on all sides. Set the Viewport X and Y positions to zero. It doesn't matter where on the canvas you position the Viewport and button, the button will always be displayed at the top-left of the canvas when you run the form (unfortunately this is not the case at design time).

    The coordinates of the stacked canvas are a function of the viewport's position relative to the window and its position on the canvas.
  • Tony Garabedian
    Tony Garabedian Member Posts: 3,375
    edited Sep 15, 2008 9:51AM
    >
    Viewport X, Y position

    Specifies the x,y coordinates for the stacked canvas's upper left corner relative to the upper left >corner of the window's current content view.

    This mean's the position of the upper left corner of your stacked canvas on top of the content >canvas.
    This is incorrect. The properties do exactly what they say they do - they specify the position of the Viewport. For a demonstration, add a new stacked canvas to a canvas then put a button in the middle of it and resize the viewport around the button, so that it is only sightly larger than the button on all sides. Set the Viewport X and Y positions to zero. It doesn't matter where on the canvas you position the Viewport and button, the button will always be displayed at the top-left of the canvas when you run the form (unfortunately this is not the case at design time).

    The coordinates of the stacked canvas are a function of the viewport's position relative to the window and its position on the canvas.
    I'm afraid you are mistaken or we are experiencing a virtual misunderstanding .

    Check the online help for these properties. The Italic line is simply copy pasted from the Online-Help.

    As for the demo case you described; I think you are confusing between the Viewport X, Y Position* and the Viewport X, Y Position on Canvas+.

    The Viewport X, Y Position is the coordinates of the upper left corner of the viewport (the visible part to the user) relative to the stacked canvas' upper left corner itself.

    The Viewport X, Y Position On Canvas is the upper left corner's coordinates of the stacked canvas relative to the content canvas which the stacked canvas is on.

    I did try your test and I have further played with both coordinates (X, Y position and X, Y position on canvas) they do work as described and as they suppose to.

    Try this scenario, the demo you described, further set the "Viewport X, Y Position" to 0 and the "Viewport X, Y Position on Canvas" to 10 this will make the stacked canvas appear on the top left corner on the content canvas and a portion of the button will appear because the viewport of the stacked canvas starts at the X=10 Y=10 coordinates of its own upper left corner.

    At design time you should see a black line showing this viewport.

    And when you change the "Viewport X, Y Position" to values greater that 10 it will change the coordinates of where the stacked canvas appears on the content canvas.


    Tony


    PS: I'm using Forms 10g R2, I haven't tested it in previous releases.

    Edited by: Tony Garabedian on Sep 15, 2008 4:46 PM
  • 611407
    611407 Member Posts: 418
    edited Sep 16, 2008 4:21AM
    The Viewport X, Y Position is the coordinates of the upper left corner of the viewport (the visible part to the user) relative to the stacked canvas' upper left corner itself.
    This contradicts what you originally stated. If what you say here is true then the X,Y Position properties will change when you move the viewport in the canvas designer window in forms builder. The properties which change when you do this are the X,Y Positions On Canvas.

    I believe it should be the case that the only controls (or parts of controls) visible on the canvas are those within the viewport, and their position relative to the content canvas is determined by the Viewport X, Y position. In general this is the case but I can create scenarios where it is not. I think this is a bug as the position of the controls on the content canvas is not related to their position in the viewport or in the stacked canvas.

    I have no time to host screenshots but perhaps I can explain one scenario:
    Create a stacked canvas and position the viewport near the centre of the canvas.
    Put 2 buttons in the viewport, 1 above the other*, with the top button overlapping the left edge of the viewport.
    When I run the form both buttons are shown on the form but the top one is cut off at the left side.
    Now move the lower button so that it too overlaps the viewport on the left side.
    When I run the form a second time both buttons are moved to the right hand side of the viewport.

    The position of the top button has not changed relative to the viewport or the canvas. The position of the viewport on the canvas has not changed (clearly at runtime the viewport position on canvas has moved to the left but in the designer the settings are unchanged) and the X,Y coordinates of the viewport have not changed. Yet the position of the button relative to the content canvas has changed.

    I'm on 10gR1 but hopefully this isn't the sort of thing Oracle decides to tamper with from one release to the next.



    *I don't mean they should occupy the same x-y location - one should be above the other on the screen, by having a smaller y-coordinate.

    Edited by: u3 on Sep 16, 2008 9:19 AM
  • Tony Garabedian
    Tony Garabedian Member Posts: 3,375
    u3 wrote:
    The Viewport X, Y Position is the coordinates of the upper left corner of the viewport (the visible part to the user) relative to the stacked canvas' upper left corner itself.
    This contradicts what you originally stated.
    I have probably mixed them up in my second post, the correct one is in the first post.

    The Viewport X, Y Position is the coordinates of the stacked canvas's upper left corner relative to the current window's content canvas which it is currently on. exactly the way I explained in my first post
    If you change those the stacked canvas's position on the content canvas will change

    The Viewport X, Y Position on Canvas is the viewport's upper left corner's coordinate relative to the stacked canvas's upper left corner.
    If you change these the viewport of the stacked canvas will change according to the canvas's upper left corner.


    I too do not have time either to host pictures and register a user (if you need to sneeze on the internet, you need to register a user and provide e-mail address).
    I have tested your scenario though;

    The buttons on the stacked canvas do not move, correct, it's the canvas's viewport that's moving across the canvas to show the button that has the focus on, it will act exactly as if you have the scrollbars set, and of course at design time it will not be changed, cause it is changed dynamically at runtime. when you re-run the form it will be back to the original place where it was set at design time.


    Tony



    PS: Interesting discussion
  • 611407
    611407 Member Posts: 418
    ...moving across the canvas to show the button that has the focus on...
    Of course! My lower button had focus when the form was opened so for the build where that was positioned outside the viewport then the viewport readjusted itself.

    The Viewport X, Y Position is the coordinates of the stacked canvas's upper left corner relative to the current window's content canvas which it is currently on.
    If you have the X,Y set to 0,0 and drag the viewport to the bottom-right corner of the stacked canvas then the area of the canvas under the viewport will be displayed at 0,0 on the content canvas (allowing for focused items being outside the viewport!). The X,Y coordinates of the stacked canvas, relative to the content canvas, will both be negative - not zero.


    It is an interesting discussion, it took me quite a while to properly understand the viewport concept. I usually set the viewport size and the canvas size to be equal, it's only for scrollable canvases that I ever make use of the viewport.
  • Tony Garabedian
    Tony Garabedian Member Posts: 3,375
    edited Sep 16, 2008 11:41AM
    u3 wrote:
    If you have the X,Y set to 0,0 and drag the viewport to the bottom-right corner of the stacked canvas then the area of the canvas under the viewport will be displayed at 0,0 on the content canvas (allowing for focused items being outside the viewport!). The X,Y coordinates of the stacked canvas, relative to the content canvas, will both be negative - not zero.
    Yes the area under the viewport will be displayed until an item outside the area gets the focus, then Forms will adjust itself.


    >
    It is an interesting discussion, it took me quite a while to properly understand the viewport concept. I usually set the viewport size and the canvas size to be equal, it's only for scrollable canvases that I ever make use of the viewport.
    It is kinda tricky, but once you get the hang of it it's quite easy, although still very easy to be confused.
    I rarely use the Viewport away from 0, 0.


    Tony

    Edited by: Tony Garabedian on Sep 16, 2008 6:40 PM
    Corrected the word "are" to "area" in the first comment
  • 639858
    639858 Member Posts: 54
    Oops !!! seems its going Trickier than i thought of. but all are really helpful but makes some what confusing as well. I'll try all the options what has been discussed above.
    thank you both of you.
This discussion has been closed.