Forum Discussion

pixaliamx's avatar
pixaliamx
Visitor
8 years ago

Suspending threads... Help!

BrightScript Micro Debugger.
Enter any BrightScript statement, debug commands, or HELP.

Suspending threads...
Thread selected:  1*   .../components/DialogLoginU.brs(29)     usuario = getStrValFromReg("user_pixtv", "datos_pixtv")

Current Function:
022:  Sub confirmSelection()
023:     m.cFocused=m.top.dialog.buttonFocused
024:     If m.cFocused=0
025:        Print"OK"
026:        Print"Entry complete, use cText value of: "+m.cText
027:        'searchText = m.cText
028:        'GuardaUser(m.cText)
029:*       usuario = getStrValFromReg("user_pixtv", "datos_pixtv")
030:        'saveStrValToReg("user_pixtv", searchText, "datos_pixtv")
031:        'alert("Alert", "You must enter a valid url in order to continue.")
032:     End If
033:     If m.cFocused=1 Print"Cancel"
Function Call Operator ( ) attempted on non-function. (runtime error &he0) in pkg:/components/DialogLoginU.brs(29)
029:       usuario = getStrValFromReg("user_pixtv", "datos_pixtv")
Backtrace:
#0  Function confirmselection() As Void
   file/line: pkg:/components/DialogLoginU.brs(29)
Local Variables:
global           Interface:ifGlobal
m                roAssociativeArray refcnt=2 count:4
usuario          <uninitialized>
getstrvalfromreg <uninitialized>
Threads:
ID    Location                                Source Code
 0    pkg:/source/Main.brs(42)                msg = wait(0, m.port)
 1*   .../components/DialogLoginU.brs(29)     usuario = getStrValFromReg("user_pixtv", "datos_pixtv")
  *selected




I try save variable flag on roku memory for mi login system.

Please help! (Anyone speak Spanish?)

'*************************************************************
'** Hello World example 
'** Copyright (c) 2015 Roku, Inc.  All rights reserved.
'** Use of the Roku Platform is subject to the Roku SDK Licence Agreement:
'** https://docs.roku.com/doc/developersdk/en-us
'*************************************************************

sub Main()

    'usr = "usuario1"
    'psw = "password1"

    'saveStrValToReg("user_pixtv", usr, "datos_pixtv")
    'saveStrValToReg("pass_pixtv", psw, "datos_pixtv")

    usuario = getStrValFromReg("user_pixtv", "datos_pixtv")
    pass = getStrValFromReg("pass_pixtv", "datos_pixtv")

    todobien = comprueba_usuario(usuario, pass)

    if todobien.error = "si" then
        print "No se ha iniciado sessión."
        showChannelLoginUSGScreen()
    end if 

    if todobien.error = "no" then
        print "Se inicio session con el usuario."
    end if
    
end Sub

sub showChannelLoginUSGScreen()
    print "in showChannelSGScreen"
    'Indicate this is a Roku SceneGraph application'
    screen = CreateObject("roSGScreen")
    m.port = CreateObject("roMessagePort")
    screen.setMessagePort(m.port)
    scene = screen.CreateScene("KeyboardDialogLoginU")
    screen.show()

    while(true)
        msg = wait(0, m.port)
        msgType = type(msg)
        if msgType = "roSGScreenEvent"
            if msg.isScreenClosed() then return
        end if
    end while
end sub



Sub init()
   m.top.backgroundURI="pkg:/images/rsgde_bg_hd.jpg"
   keyboarddialog=createObject("roSGNode","KeyboardDialog")
   keyboarddialog.backgroundUri="pkg:/images/rsgde_dlg_bg_hd.9.png"
   keyboarddialog.title="Usuario"
   keyboarddialog.buttons=["OK","Cancel"]
   keyboarddialog.observeField("text","dbText")
   keyboarddialog.observeField("buttonSelected","confirmSelection")
   m.top.dialog=keyboarddialog
   m.cText="" 'initialize variable for this component
   m.cFocused=0 'initialize variable
   m.top.setFocus(TRUE)
End Sub

Sub dbText()
   Print"Text: "+m.top.dialog.text
   m.cText=m.cText+right(m.top.dialog.text,1) 'Grab the right character of the dialog text
   If Len(m.top.dialog.text)>40 m.top.dialog.text=Right(m.top.dialog.text,40) 'truncate value for display with a limit of 40 characters
   Print"CTEXT:"+m.cText 'Print copied value to screen
End Sub

Sub confirmSelection()
   m.cFocused=m.top.dialog.buttonFocused
   If m.cFocused=0
      Print"OK"
      Print"Entry complete, use cText value of: "+m.cText
      'searchText = m.cText
      'GuardaUser(m.cText)
      usuario = getStrValFromReg("user_pixtv", "datos_pixtv")
      'saveStrValToReg("user_pixtv", searchText, "datos_pixtv")
      'alert("Alert", "You must enter a valid url in order to continue.")
   End If
   If m.cFocused=1 Print"Cancel"
End Sub



5 Replies

  • This is not thread related - it's a regular error, see below i only left the relevant parts. You are trying to call function "getStrValFromReg" and there isn't one that it seems:
    "pixaliamx" wrote:

    ...
    Function Call Operator ( ) attempted on non-function. (runtime error &he0) in pkg:/components/DialogLoginU.brs(29)
    029:       usuario = getStrValFromReg("user_pixtv", "datos_pixtv")
    Backtrace:
    #0  Function confirmselection() As Void
       file/line: pkg:/components/DialogLoginU.brs(29)
    Local Variables:
    ...
    getstrvalfromreg <uninitialized>
    ...
  • How can i bind the 'saveStrValToReg("user_pixtv", searchText, "datos_pixtv") function?

    You have other example for access login?

    components/DialogLoginU.xml
    <?xml version="1.0" encoding="utf-8" ?>
    <!--********** Copyright 2016 Roku Corp.  All Rights Reserved. **********-->

    <component name="KeyboardDialogLoginU" extends="Scene">

         <script type="text/brightscript">
        <![CDATA[
        Sub init()
      m.top.backgroundURI="pkg:/images/rsgde_bg_hd.jpg"
      keyboarddialog=createObject("roSGNode","KeyboardDialog")
      keyboarddialog.backgroundUri="pkg:/images/rsgde_dlg_bg_hd.9.png"
      keyboarddialog.title="Usuario"
      keyboarddialog.buttons=["OK","Cancel"]
      keyboarddialog.observeField("text","dbText")
      keyboarddialog.observeField("buttonSelected","confirmSelection")
      m.top.dialog=keyboarddialog
      m.cText="" 'initialize variable for this component
      m.cFocused=0 'initialize variable
      m.top.setFocus(TRUE)
    End Sub

    Sub dbText()
      Print"Text: "+m.top.dialog.text
      m.cText=m.cText+right(m.top.dialog.text,1) 'Grab the right character of the dialog text
      If Len(m.top.dialog.text)>40 m.top.dialog.text=Right(m.top.dialog.text,40) 'truncate value for display with a limit of 40 characters
      Print"CTEXT:"+m.cText 'Print copied value to screen
    End Sub

    Sub confirmSelection()
      m.cFocused=m.top.dialog.buttonFocused
      If m.cFocused=0
         Print"OK"
         Print"Entry complete, use cText value of: "+m.cText
         saveStrValToReg("user_pixtv", m.cText, "datos_pixtv")
      End If
      If m.cFocused=1 Print"Cancel"
    End Sub

        ]]>
      </script>
    </component>


    source/conections.brs

    Function saveStrValToReg(keyname As String, val As String, section As String) As Boolean
        reg = CreateObject("roRegistrySection", section)
        reg.Write(keyname, val)
        return reg.Flush()
    End Function
  • destruk's avatar
    destruk
    Streaming Star
    roRegistry can only be used in the main thread (outside of scenegraph), or a task node thread.
  • "destruk" wrote:
    roRegistry can only be used in the main thread (outside of scenegraph), or a task node thread.

    Will you have an example?