Search code examples
rokubrightscript

Click button not fire a click Event and how to navigate another panel in ROKU


I create the Login panel in Roku. At a Login time, I click ok button to navigate another panel it is possible.

I create a login panel with using two text boxes one for username and another for password and two buttons one for sign-in and another for cancel. An issue is I click the sign-in button but not click event fire

I use button group and the following code in onkeyevent

if m.btngrp.buttonSelected = 0 then 
      if key = "OK"
            ? "print the sign-in button"
      end if
else if m.btngrp.buttonSelected = 1 then
      if key = "OK"
            ? "print the setting button"
      end if            
else 
      ? "nothing press"
end if

please anyone find these problem help me.


Solution

  • I'm assuming you already have an observer set in the Button Group component:

    m.btngrp.observeField("buttonSelected", "onButtonSelected")
    

    Then, in the callback you should have:

    function onButtonSelected()
        if m.btngrp.buttonSelected = 0 then 
             ? "print the sign-in button"
        else if m.btngrp.buttonSelected = 1 then
             ? "print the setting button"
        end if
    end function