0

resize/reposition

I have a section of a UI where I have a Text label above a Grid. Usually the Text is one line, but there are cases when the data spills onto a second line.

I have written code that I thought would reposition the grid, but it does not have the effect I am looking for

CODE
        log("new y? "+this.menuTitle.vOffset+"+"+this.menuTitle.height);
var y2 = this.menuTitle.vOffset+this.menuTitle.height;

if (true) {
this.grid.setStyles({
vOffset: y2,
height: this.height - y2 - this.pi.height
});
this.grid.config.rows = this.rowsForGrid(this.grid.height);
} else {
this.grid.y = y2;
this.grid.height = this.height - y2 - this.pi.height;

this.grid.rows = this.rowsForGrid(this.grid.height);
}


You can see two attempts. The second does not work at all. The first works initially, but as soon as focus passes out of the grid it is re-rendered in its original position, corrupting the rendering of the multi-line Text label above it.

I could not find any instance of the word "reposition" in the YWE Developer Guide. Does the YWE support altering the position and dimensions of UI elements, or should I just create a fresh Grid in the new rectangle when the label resizes itself?

by
6 Replies
  • Hi you,
    I'm not clear with your post, but what you want is a GUI with the text and the grid, dont you? :DJerry
    0
  • For a little more background, where exactly are you calling this code (createView, updateView, onSelect, etc)? Are you trying to display a different title as you navigate through the grid, or does the title stay the same each time you visit the view?
    0
  • QUOTE (Jerry Dang @ Nov 10 2009, 07:39 PM) <{POST_SNAPBACK}>
    Hi you,
    I'm not clear with your post, but what you want is a GUI with the text and the grid, dont you? :DHere is an example menu. Notice that the MIT menu has a particularly long title, while the others are relatively short.
    0
  • QUOTE (mutantbob @ Nov 11 2009, 07:03 AM) <{POST_SNAPBACK}>
    When I this.menuTitle.data=menu.title; the Text element at the top can change from a one-line to a two-line title (or even three-line if the text were long enough). Even the background color extends onto the second line. To my eyes it appears to resize itself.

    If you set the width of a Text element, and set wrap to true, then I believe it should expand vertically as you say. I still don't understand why the grid would reposition itself to it's original location when you move focus off the grid. So, you are capturing the onSelect event within the grid, and making you request? Are you doing anything with the onFocus or onBlur events? Could you possibly post the code?
    0
  • QUOTE (Steve @ Nov 11 2009, 07:44 AM) <{POST_SNAPBACK}>
    I still don't understand why the grid would reposition itself to it's original location when you move focus off the grid. So, you are capturing the onSelect event within the grid, and making you request? Are you doing anything with the onFocus or onBlur events? Could you possibly post the code?


    I am capturing the onSelect event of a GridCell and launching an asynchronous XMLHTTPRequest.

    I de-brained my widget and hardcoded a menu structure and have posted it here.

    Choose the "Bob collection", then choose item "two". This will have a long name. Navigate focus out of the grid and you will see the grid malfunction.

    If you then select the "video" item you can observe a separate bug where focus is completely destroyed and navigation becomes impossible.
    0
  • I posted some code to another thread that may help you: http://developer.yahoo.net/forum/index.php...l=resize+button

    The problem with a focus change moving things back where they were I was able to address by setting not only styles, but also config.styles.
    0

Recent Posts

in Design / Interaction - Yahoo! TV Widgets