Starting Focus Stuck

I set my top button to focused()=true on startup - the intention is to have one button start with focus. However in the iHDSim, I cannot nav away from this button. If I do not set focused(), then no buttons have focus, however I can click on one and then get proper navigation.



Answer this question

Starting Focus Stuck

  • oceansis

    <button id="AUDIO01" style="BTN_AUDIO_01" class="BTN_PLAY BTN_FOCUS" state:focused="true" />

    Should be

    <button id="AUDIO01" style="BTN_AUDIO_01" class="BTN_PLAY BTN_FOCUS" focused="true" />

    or

    <button id="AUDIO01" style="BTN_AUDIO_01" class="BTN_PLAY BTN_FOCUS" focus="true" />

    Try both...

    I will look on Wednesday when I get back in the office...Hit me up when you are back also you can check my project out.


  • zppro

    Hmm, neither focused="true" or focus="true" is in the spec, nor recgonized when I build them in.

    Out of frustration I rewrote the markup and now state:focused="true" is working.  Not sure what was wrong but neither the validator or VS intellisense caught it.





  • sureshsundar007

    Just to be super-clear, you should put it in the <body> section, not the <timing> section. You put it directly on the <button> element, then the user should be able to over-ride it (as long as you don't have any overriding timing or script animations on state:focused)

  • Francisco6783

    Just set state:focused="true" on that button in markup.

    If you must do it through script, then might I suggest you revist my blog post :-)

    http://blogs.msdn.com/ptorr/archive/2006/09/08/746678.aspx



  • guile0

    Ya I did that in the markup, but as I said the focus won't move off that button. I thought perhaps I had misunderstood something. I'll go back and look over my markup and make sure no timing elements are conflicing. I can't think why else that would stick the focus.

    If I don't set a starting focus things navigate fine, once I use the mouse to get focus somewhere.


  • IanR

    What's interesting is if I create a dummy button and give it focus, then I can nav away from it and everything works fine. The menu just starts with no buttons in focus. So something in my timing must be in conflict with setting the focused state to true for buttons that have timing actions assigned to them.


  • PRMARJORAM

    I'm not sure what is going wrong. At one point I thought it was the USB keyboard. Basically if I set any of the buttons to focused in the markup, then I cannot navigate to other buttons using the arrow keys. Why would I be able to use the mouse but not the arrow keys

    MARKUP


            <timing clock="page">
                <defs>
                    <!-- Effects for opening and closing main menu. -->
                    <g id="OpenMenu">
                        <set style:display="auto" />
                        <animate style:x="-450px;0px" />
                    </g>
                    <g id="CloseMenu">

                        <animate style:x="0px;-450px" />
                    </g>

                    <!-- Effects for check boxes. -->
                    <g id="BoxChecked">
                        <event name="SettingBoxChecked" />
                    </g>
                   
                    <!-- Effects for buttons. -->
                    <g id="ButtonFocus">
                        <set style:backgroundFrame="1" />
                    </g>
                    <g id="PlayAudio">
                        <event name="PlayAudioTrack" />
                    </g>
                   
                    <!-- Menu state management. -->
                    <set id="StateMenuCanOpen" style:x="0px"/>
                    <set id="StateMenuCanClose" style:x="1px"/>
                </defs>

                <par>
                    <!-- Navigable menu buttons. -->
                    <cue use="ButtonFocus" begin="id('AUDIO01')[state:focused()=true()]" end="defaultNode()[state:focused()=false()]" />
                    <cue use="ButtonFocus" begin="id('AUDIO02')[state:focused()=true()]" end="defaultNode()[state:focused()=false()]" />   
                    <cue use="ButtonFocus" begin="id('AUDIO03')[state:focused()=true()]" end="defaultNode()[state:focused()=false()]" />   
                    <cue use="ButtonFocus" begin="id('RANDOM')[state:focused()=true()]" end="defaultNode()[state:focused()=false()]" />   
                    <cue use="ButtonFocus" begin="id('SHUFFLE')[state:focused()=true()]" end="defaultNode()[state:focused()=false()]" />   
                    <cue use="ButtonFocus" begin="id('SEQUENTIAL')[state:focused()=true()]" end="defaultNode()[state:focused()=false()]" />

                    <!-- Settings selection. -->
                    <cue use="BoxChecked" begin="class('BTN_SETTING')[state:actioned()=true()]" dur="100ms" />

                    <!-- Track selection. -->
                    <par begin="class('BTN_PLAY')[state:actioned()=true()]" dur="2s" >
                        <cue use="PlayAudio" begin="1s" dur="1s" />
                    </par>
                                    <!-- Settings selection. -->
                    <cue use="BoxChecked" begin="id('RANDOM')[state:actioned()=true()]" dur="1s" />
                    <cue use="BoxChecked" begin="id('SHUFFLE')[state:actioned()=true()]" dur="1s" />
                    <cue use="BoxChecked" begin="id('SEQUENTIAL')[state:actioned()=true()]" dur="1s" />

                    <!-- Track selection. -->
                    <par begin="class('BTN_PLAY')[state:actioned()=true()]" dur="3s" >
                        <cue use="PlayAudio" begin="2s" dur="2s" />
                    </par>
                   
                    <!-- Open the menu if Menu button is pressed. -->
                    <par begin="(id('BTN_MENU')[state:actioned()=true()] and id('MENU_STATE')[style:x()='0px'])"
                          end="(id('BTN_MENU')[state:actioned()=true()] and id('MENU_STATE')[style:x()='1px'])">

                        <cue select="id('MENU_STATE')" dur="1s" fill="hold" use="StateMenuCanClose" />
                        <cue select="id('MENU')" dur="1s" fill="hold" use="OpenMenu" />
                    </par>

                    <!-- Close the menu if Menu button is pressed or if track is selected for play. -->
                    <par begin="((id('BTN_MENU')[state:actioned()=true()] or class('BTN_PLAY')[state:actioned()=true()])
                                and id('MENU_STATE')[style:x()='1px'])"
                         
                          end="(id('BTN_MENU')[style:x()='-450px'] or (id('BTN_MENU')[state:actioned()] and id('MENU_STATE')[style:x()='0px']))">

                        <cue select="id('MENU_STATE')" dur="1s" fill="hold" use="StateMenuCanOpen" />
                        <cue select="id('MENU')" dur="1s" fill="hold" use="CloseMenu" />
                    </par>
                </par>

            </timing>
        </head>
        <body>
            <!-- Static Background -->
            <div id="BG" style="BACKGROUND" >
            </div>

            <!-- Popup Menu -->
            <div id="MENU" style="MAIN_MENU" >
                <div id="PLY_BTNS" style="PLAY_BUTTON_CONTAINER">
                    <button id="AUDIO01" style="BTN_AUDIO_01" class="BTN_PLAY BTN_FOCUS" />
                    <button id="AUDIO02" style="BTN_AUDIO_02" class="BTN_PLAY BTN_FOCUS" />
                    <button id="AUDIO03" style="BTN_AUDIO_03" class="BTN_PLAY BTN_FOCUS" />
                </div>
                <div id="PLY_SETTINGS" style="PLAY_SETTING_CONTAINER">
                    <div id="CHKBOXES" style="CHECKBOX_CONTAINER">
                        <div id="BOX1" style="CHECKBOX_01" />
                        <div id="BOX2" style="CHECKBOX_02" />
                        <div id="BOX3" style="CHECKBOX_03" />
                    </div>
                    <div id="SETTINGS_BTNS" style="SETTING_BUTTON_CONTAINER">
                        <button id="RANDOM" style="BTN_RANDOM" class="BTN_FOCUS" />
                        <button id="SHUFFLE" style="BTN_SHUFFLE" class="BTN_FOCUS" />
                        <button id="SEQUENTIAL" style="BTN_SEQUENTIAL" class="BTN_FOCUS" />               
                    </div>
                </div>
            </div>

            <!-- Hidden button for toggling Main Menu. -->
            <div>
                <button id="BTN_MENU" accessKey="VK_MENU" />
                <div id="MENU_STATE" />
            </div>
        </body>
    </root><par>
    <!-- Navigable menu buttons. -->
    <cue use="ButtonFocus" begin="id('AUDIO01')[state:focused()=true()]" end="defaultNode()[state:focused()=false()]" />
    <cue use="ButtonFocus" begin="id('AUDIO02')[state:focused()=true()]" end="defaultNode()[state:focused()=false()]" />
    <cue use="ButtonFocus" begin="id('AUDIO03')[state:focused()=true()]" end="defaultNode()[state:focused()=false()]" />
    <cue use="ButtonFocus" begin="id('RANDOM')[state:focused()=true()]" end="defaultNode()[state:focused()=false()]" />
    <cue use="ButtonFocus" begin="id('SHUFFLE')[state:focused()=true()]" end="defaultNode()[state:focused()=false()]" />
    <cue use="ButtonFocus" begin="id('SEQUENTIAL')[state:focused()=true()]" end="defaultNode()[state:focused()=false()]" />
    <cue use="BoxChecked" begin="id('RANDOM')[state:actioned()=true()]" dur="1s" />
    <cue use="BoxChecked" begin="id('SHUFFLE')[state:actioned()=true()]" dur="1s" />
    <cue use="BoxChecked" begin="id('SEQUENTIAL')[state:actioned()=true()]" dur="1s" />
    <par begin="id('AUDIO01')[state:actioned()=true()]" dur="3s" >
    <cue select="id('AUDIO01')" use="PlayAudio" begin="2s" dur="2s" />
    </par>
    <par begin="id('AUDIO02')[state:actioned()=true()]" dur="3s" >
    <cue select="id('AUDIO02')" use="PlayAudio" begin="2s" dur="2s" />
    </par>
    <par begin="id('AUDIO03')[state:actioned()=true()]" dur="3s" >
    <cue select="id('AUDIO03')" use="PlayAudio" begin="2s" dur="2s" />
    </par>

    <!-- Open the menu if Menu button is pressed. -->
    <par begin="(id('BTN_MENU')[state:actioned()=true()] and id('MENU_STATE')[style:x()='0px'])"
    end="(id('BTN_MENU')[state:actioned()=true()] and id('MENU_STATE')[style:x()='1px'])">

    <cue select="id('MENU_STATE')" dur="1s" fill="hold" use="StateMenuCanClose" />
    <cue select="id('MENU')" dur="1s" fill="hold" use="Show" />
    <cue select="id('MENU')" dur="1s" fill="hold" use="OpenMenu" />
    </par>

    <!-- Close the menu if Menu button is pressed or if track is selected for play. -->
    <par begin="((id('BTN_MENU')[state:actioned()=true()] or class('BTN_PLAY')[state:actioned()=true()])
    and id('MENU_STATE')[style:x()='1px'])"

    end="(id('BTN_MENU')[style:x()='-450px'] or (id('BTN_MENU')[state:actioned()] and id('MENU_STATE')[style:x()='0px']))">

    <cue select="id('MENU_STATE')" dur="1s" fill="hold" use="StateMenuCanOpen" />
    <cue select="id('MENU')" dur="1s" fill="hold" use="CloseMenu" />
    <cue select="id('MENU')" dur="1s" fill="hold" use="Show" />
    </par>
    </par>

    </timing>
    </head>
    <body>
    <!-- Static Background -->
    <div id="BG" style="BACKGROUND" >
    </div>

    <!-- Popup Menu -->
    <div id="MENU" style="MAIN_MENU" >
    <div id="PLY_BTNS" style="PLAY_BUTTON_CONTAINER">
    <button id="AUDIO01" style="BTN_AUDIO_01" class="BTN_PLAY BTN_FOCUS" state:focused="true" />
    <button id="AUDIO02" style="BTN_AUDIO_02" class="BTN_PLAY BTN_FOCUS" />
    <button id="AUDIO03" style="BTN_AUDIO_03" class="BTN_PLAY BTN_FOCUS" />
    </div>
    <div id="PLY_SETTINGS" style="PLAY_SETTING_CONTAINER">
    <div id="CHKBOXES" style="CHECKBOX_CONTAINER">
    <div id="BOX1" style="CHECKBOX_01" />
    <div id="BOX2" style="CHECKBOX_02" />
    <div id="BOX3" style="CHECKBOX_03" />
    </div>
    <div id="SETTINGS_BTNS" style="SETTING_BUTTON_CONTAINER">
    <button id="RANDOM" style="BTN_RANDOM" class="BTN_FOCUS" />
    <button id="SHUFFLE" style="BTN_SHUFFLE" class="BTN_FOCUS" />
    <button id="SEQUENTIAL" style="BTN_SEQUENTIAL" class="BTN_FOCUS" />
    </div>
    </div>
    </div>

    <!-- Hidden button for toggling Main Menu. -->
    <div>
    <button id="BTN_MENU" accessKey="VK_MENU" />
    <div id="MENU_STATE" />
    </div>
    </body>



  • Starting Focus Stuck