首页 > 解决方案 > 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.

标签: rokubrightscript

解决方案


我假设您已经在 Button Group 组件中设置了一个观察者:

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

然后,在回调中你应该有:

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

推荐阅读