0

TabStrip onFocus event issue

Hi All,
I want to access the onfocus event of a tabstrip to dynamically load the tabstrip tabs once the user focuses on the tabs.
I checked onto the control.tabs.js in the Framework 1.1 and found that _focusIndex is the propety it is using to access the focussed index.

Although in log I could see the focusButton(index: 2) but I am unable to access this property index: 2. I tried using this._focusIndex to access it but it is coming as 0 first time, another time it is not coming to onFocus event.

I also tried the getFocusIndex method, but it also could not yield me results.

Could you suggest where am I wrong in doing the things, and how can I achieve the same?

Thanks,
Ashish Jain

by
20 Replies
  • QUOTE (ashish @ Jul 13 2009, 04:19 AM) <{POST_SNAPBACK}>
    I want to access the onfocus event of a tabstrip to dynamically load the tabstrip tabs once the user focuses on the tabs.


    This objective is not entirely clear.

    Are you trying to change the content of the tabstrip after it has been rendered? Attempting to do this on focus of the control sounds like a sure-fire way to shoot yourself in the foot.
    0
  • QUOTE (keville @ Jul 21 2009, 04:04 PM) <{POST_SNAPBACK}>
    This objective is not entirely clear.

    Are you trying to change the content of the tabstrip after it has been rendered? Attempting to do this on focus of the control sounds like a sure-fire way to shoot yourself in the foot.


    Yes, the entire issue is that I have 15 values which needs to be shown on the tabStrip(or something like it) and I am showing 5 at a time (as the text on each tab is allowing this much only in sidebar).
    Now I want to check that in case the focussed tab is having index like 5,10 or 15, I need to rotate the tabs to show 6-10, 11-15 and so on, making it cyclic for user.
    For making this scrolling (or internally just the text change on the five rendered tabs) I need to access the focusIndex of the tab focussed.

    Please let me know in case I can do this or it might create a major issue.
    In case I can use something different, easier than this ( can I use grid also)?

    Thanks,
    Ashish Jain
    0
  • QUOTE (ashish @ Jul 21 2009, 11:28 PM) <{POST_SNAPBACK}>
    Yes, the entire issue is that I have 15 values which needs to be shown on the tabStrip(or something like it) and I am showing 5 at a time (as the text on each tab is allowing this much only in sidebar).
    Now I want to check that in case the focussed tab is having index like 5,10 or 15, I need to rotate the tabs to show 6-10, 11-15 and so on, making it cyclic for user.
    For making this scrolling (or internally just the text change on the five rendered tabs) I need to access the focusIndex of the tab focussed.

    Please let me know in case I can do this or it might create a major issue.
    In case I can use something different, easier than this ( can I use grid also)?

    Thanks,
    Ashish Jain


    I think I am looking at the wrong onFocus event, because when I checked this "onFocus" it is firing once when the first tab is selected as the view is loaded and then when I change the focus from one TabStrip button to another then it doesn't fire, which makes sense also as this is for the tabstrip and not for the tabStripButton.

    I think I need to make tabStripButtons and add to this tabStrip and then need to catch button's onFocus event.
    Please help me with your insight?

    Thanks,
    Ashish Jain
    0
  • How are you using the this._focusIndex

    Generally on a tabstrip I think focus ends up on the TabButtons it creates.

    Can you post the code you are using to test the current index?
    0
  • QUOTE (Mike @ Jul 13 2009, 03:16 PM) <{POST_SNAPBACK}>
    How are you using the this._focusIndex

    Generally on a tabstrip I think focus ends up on the TabButtons it creates.

    Can you post the code you are using to test the current index?



    Hi Mike,
    I have posted the code to you at tvwidgets@yahoo-inc.com.
    Please check and please help me out with the problem.

    Thanks,
    Ashish Jain
    0
  • QUOTE (ashish @ Jul 13 2009, 11:07 PM) <{POST_SNAPBACK}>
    Hi Mike,
    I have posted the code to you at tvwidgets@yahoo-inc.com.
    Please check and please help me out with the problem.

    Thanks,
    Ashish Jain



    Any update on this?

    Thanks,
    Ashish Jain
    0
  • QUOTE (ashish @ Jul 16 2009, 10:45 PM) <{POST_SNAPBACK}>
    Any update on this?

    Thanks,
    Ashish Jain



    Hi Mike,
    Could you check on the code?

    Thanks,
    Ashish Jain
    0
  • Mike is not labeled as a "Yahoo" admin. Doubt he can check the code... :bHe is in groups "Member" not "Yahoos"
    0
  • I also think Mike meant to post the code you are trying to use to the forums. In a Codebox.
    0
  • Yep - not a part of Yahoo, I'm not going to be able to check that out ;-)
    0
  • QUOTE (Mike @ Jul 20 2009, 09:13 AM) <{POST_SNAPBACK}>
    Yep - not a part of Yahoo, I'm not going to be able to check that out ;-)



    I am extremely sorry :(
    0
  • Right you want to check the onFocus of the buttons. I think I tried this once and had trouble with it though.

    That being said however, I think I pushed in more buttons then would fit once and it would still allow you to scroll through all the tabs. Something else you might try is see if instead of onFocus for the TabStrip you can capture the onNavigate event and see if this fires every time someone goes right/left on the tab buttons.

    A Brute force method would be detect the onFocus and onBlur events of the TabStrip and when those occur register a key handler to detect the right and left buttons. then use tabstrip.getFocusIndex() to figure out where you are and if you can scroll.

    Like I said though, put in all 15 buttons at once and see if this works for you.
    0
  • The TabStrip is designed to scroll its tab content left and right automatically when navigating in large button sets. It should darken the edges of the control to indicate that there is more tab content to view.

    Focus should remain centered until the end of the tab content is reached, then it moves right to the end of the tab set. Focus moves back to and stays in the center when naving left again, until the left edge of the content is reached.
    0
  • QUOTE (keville @ Jul 22 2009, 10:25 AM) <{POST_SNAPBACK}>
    The TabStrip is designed to scroll its tab content left and right automatically when navigating in large button sets. It should darken the edges of the control to indicate that there is more tab content to view.

    Focus should remain centered until the end of the tab content is reached, then it moves right to the end of the tab set. Focus moves back to and stays in the center when naving left again, until the left edge of the content is reached.


    Thanks a lot Keville.

    I checked and found that yes the tabs focus is changing when we have more tabs (this I checked by seeing the _focusButton(index: 10) in console) but still the UI is showing the same 5 tabs and the left and right arrows are working fine. Once I use again the left arrow it takes the focus on the visible tabs.

    Could you please check and let me know in case any property am missing by which the scrolling of UI is not done in my case.

    I am using Framework 1.1 of "ywe-wdk-0.9.5-33-i386".

    Thanks,
    Ashish Jain
    0
  • From your code above it appears that you are correctly setting the width of the TabStrip (matching the view's width), so I am unsure why you would not have the expected focus behavior on your "long" tab set.

    When you build the TabStrip with the full button set, does the right edge of the strip have a shadow to indicate that there is additional tab content to be scrolled to?
    0
  • QUOTE (keville @ Jul 23 2009, 03:15 PM) <{POST_SNAPBACK}>
    From your code above it appears that you are correctly setting the width of the TabStrip (matching the view's width), so I am unsure why you would not have the expected focus behavior on your "long" tab set.

    When you build the TabStrip with the full button set, does the right edge of the strip have a shadow to indicate that there is additional tab content to be scrolled to?



    Hi Keville,
    Yes, there is some portion of the tab which is seen to me at the end of the visible tabs and even the focus goes to that partially visible tab. If you want to check the problem then I can send the code to you.

    Please let me know what can be done as it has stuck my work.

    Thanks for the great help.

    Thanks,
    Ashish Jain
    0
  • It sounds like we could use a peek at your code to see where you're getting stuck. Please send an archive containing your Widget to tvwidgets@yahoo-inc.com with the following subject: "TabStrip code sample for kneville" and it will get right to the correct person - me :)Thanks!
    0
  • QUOTE (keville @ Jul 27 2009, 01:24 PM) <{POST_SNAPBACK}>
    It sounds like we could use a peek at your code to see where you're getting stuck. Please send an archive containing your Widget to tvwidgets@yahoo-inc.com with the following subject: "TabStrip code sample for kneville" and it will get right to the correct person - me :)Ashish Jain
    0
  • Hi Keville,
    Have you got the code I sent?

    Thanks,
    Ashish Jain
    0
  • QUOTE (ashish @ Jul 30 2009, 01:27 AM) <{POST_SNAPBACK}>
    Hi Keville,
    Have you got the code I sent?

    Thanks,
    Ashish Jain


    Keville,
    Please close this thread as after installing the new WDK, it started scrolling on its own with the code I gave to you.

    Thanks for the help.
    Ashish Jain
    0

Recent Posts

in General - Yahoo! TV Widgets