How to remove focus in ButtonGroup without any Method using Brightscript?

0

I am using one button group and I set focus to Button Group using focusButton and buttonSelected. But focusButton set the first button Focus using 0 indexes and second button focus using 1 index successfully.

I tried to remove focus if I press up key then remove focus from button group.

I successfully with m.btngrp.setFocus(false) But, Issue is this method calling time my keyevent is not working.

Does anyone know that issue?

Edited Post

function onKeyEvent(key as String, press as Boolean) as Boolean

? "press value : " press
? "key value : " key
handled = false   
if press = true then    
   if m.keyid.active = true and key = "OK" then
   ?"Email Ok Press"            
        showdialogid()   
        return handled 

   else if m.keypass.active = true and key = "OK" then
        ?"Password Ok Press"

                showdialogpass()
                return handled 
   end if
   return handled 
end if

if press = false then     

      if key = "OK" and m.btnLogout.focusBitmapUri <> ""

         ?"Click the Logout button"

         m.btnLogout.visible = false
         m.btnLogout.focusBitmapUri = ""
         m.loginscreengrp.visible = true
         m.keyid.active = true
         return true

      else if key = "OK" and m.btnsubmit.focusBitmapUri <> "" 

        ?"Click the sign-in button"

         m.loginscreengrp.visible = false
         m.btnLogout.visible = true
         m.btnLogout.setFocus(true)
         m.btnLogout.focusBitmapUri = "pkg:/images/Logout.png"
         m.btnLogout.focusedTextColor = "0x00000000"
         return true

      end if 

      if key = "up" or key = "down"

            if key = "down"
                    ?"here down key"

                    if m.keypass.active = true 

                        m.keypass.setFocus(false)
                        m.keypass.active = false
                        m.btnsubmit.setFocus(true)
                        m.btnsubmit.focusBitmapUri = "pkg:/images/newsignin.png"
                        m.btnsubmit.focusedTextColor = "0x00000000"
                        handled = true

                    else if m.keyid.active = true

                        m.keyid.setFocus(false)
                        m.keyid.active = false
                        m.keypass.setFocus(true)
                        m.keypass.active = true
                        handled = true

                    else if m.btnsubmit.focusBitmapUri <> "" 
                        ? "setting active and key down press " 
                        m.btnsubmit.setFocus(false)
                        m.btnsubmit.focusBitmapUri = "" 
                        m.btnsetting.setFocus(true)
                        m.btnsetting.focusBitmapUri = "pkg:/images/newsetting.png"
                        m.btnsetting.focusedTextColor = "0x00000000"
                        handled = true

                    else if m.btnsetting.focusBitmapUri <> "" 
                       ? "id active and key down press"
                       m.btnsetting.setFocus(false)
                       m.btnsetting.focusBitmapUri = ""
                       m.keyid.setFocus(true)
                       m.keyid.active = true
                       handled  = true

                    end if
                    handled = true

            else if key = "up"

                    ? "here up key"
                    if m.keypass.active = true 

                        ?"id active and press up"
                        m.keypass.active = false
                        m.keyid.active = true
                        handled = true

                    else if m.keyid.active = true 

                        ?"setting active and press up"

                        m.keyid.active = false
                        m.btnsetting.setFocus(true)
                        m.btnsetting.focusBitmapUri = "pkg:/images/newsetting.png"
                        m.btnsetting.focusedTextColor = "0x00000000"
                        handled = true

                    else if m.btnsetting.focusBitmapUri <> "" 
                         ?"submit active and press up"

                         m.btnsetting.focusBitmapUri = ""
                         m.btnsetting.setFocus(false)
                         m.btnsubmit.setFocus(true)
                         m.btnsubmit.focusBitmapUri = "pkg:/images/newsignin.png"
                         m.btnsubmit.focusedTextColor = "0x00000000"
                         handled = true

                    else if m.btnsubmit.focusBitmapUri <> "" 

                        ? "pass active and press up"                         
                        'press = false
                        ? "press value active : " press 
                        m.btnsubmit.focusBitmapUri = ""
                        m.btnsubmit.setFocus(false)
                        m.keypass.setFocus(true)
                        m.keypass.active = true
                        handled = true
                    end if
                    handled = true
                end if
                handled = true
            end if
        return handled
   end if
   return true
end function
roku
brightscript
asked on Stack Overflow Jul 22, 2019 by Nikunj Chaklasiya • edited Jul 25, 2019 by Nikunj Chaklasiya

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0