Forum Discussion

devCodezyng's avatar
devCodezyng
Reel Rookie
3 years ago

How to add search button to my roku channel

im trying to add search button to my channel which can search all the content in my show how to do that? How to create a splash screen like youtube has ?

11 Replies

  • Hello! Have you written the search functionality? A search function? If so, it is as simple as adding a button in your XML file and the BrightScript file, observing the field and adding the function. Like so, in XML:

    <children>
      <Button 
          id="searchButton" 
          text = "Search Button"
          showFocusFootprint = "true"
     />
    </children>

      Now BrightScript brs file:

    sub init()
      m.searchButton = m.top.findNode("searchButton")
      m.searchButton.observeField("buttonSelected","searchFunction")
    end sub
    
    function searchFunction()
      //your code and logic
    end function

    Further reading, Roku docs for button: https://developer.roku.com/en-gb/docs/references/scenegraph/widget-nodes/button.md 

    I hope this helps!