"belltown" wrote:
I don't see why setting m.top.dialog in the child component wouldn't work. Are you setting this in one of the event-handlers in the child's brs code? And is keyboardDlg set up correctly when assigning it to m.top.dialog in the child component?
sub OnItemSelected()
m.index = m.top.itemSelected
if m.index = 0
print "about selected"
else if m.index < 3
print "open keyboard"
m.keyboardDlg = createObject("RoSGNode", "KeyboardDialog")
m.keyboardDlg.title = "Login"
m.keyboardDlg.text = " "
m.keyboardDlg.observeField("buttonSelected", "OnButtonSelected")
m.keyboardDlg.observeField("text", "OnTextChanged")
if m.index = 1
m.keyboardDlg.message = "Entre o e-mail do usuário:"
if m.global.user <> ""
m.keyboardDlg.text = m.global.user
else
m.keyboardDlg.text = "@email.com"
end if
m.keyboardDlg.keyboard.textEditBox.secureMode = false
else if m.index = 2
m.keyboardDlg.message = "Entre a senha do usuário:"
m.keyboardDlg.text = ""
m.keyboardDlg.keyboard.textEditBox.secureMode = true
end if
[OPTION 1] m.top.scene.dialog = m.keyboardDlg <========= Dialog is Shown
[OPTION 2] m.top.dialog = m.keyboardDlg <============= Nothing happens
else
m.infoLabel.text = ""
item = m.optionsList.content.getChild(2).getChild(m.index - 3)
if item.id <> m.global.maxRes
m.global.maxRes = item.id
LoadMenuItems()
m.optionsList.jumpToItem = m.index
end if
end if
end sub
"belltown" wrote:
Why do you need the parent's m.top? Can't you set the child's m.top.dialog to the Dialog?
nxt = m.top
while nxt <> invalid:
scene = nxt
nxt = scene.getParent()
end while
' at this point `scene` is the top-most node `
"EnTerr" wrote:"belltown" wrote:
Why do you need the parent's m.top? Can't you set the child's m.top.dialog to the Dialog?
Because not every component has a .dialog property.
Only Scene nodes have that property.
And since saw elsewhere we should use only one and only scene, that means there is only one such node per RSG.
His question is how can i find the scene from one of the children, nested levels down?
I suppose can just walk the tree up:nxt = m.top
while nxt <> invalid:
scene = nxt
nxt = scene.getParent()
end while
' at this point `scene` is the top-most node `
"EnTerr" wrote:
Because not every component has a .dialog property.
Only Scene nodes have that property.
And since saw elsewhere we should use only one and only scene, that means there is only one such node per RSG.
scene = invalid
for each nod in m.top.getRoots():
if nod.isSubType("scene") then scene = nod: exit for
next
"RokuNB" wrote:
or you can do
m.top.getRoots()
"belltown" wrote:
According to the docs, the note above getRoots() states: The following methods can be called on any subject node and return the same global results. They can be used in a development channel for debugging purposes, but should not be used in a production channel. and then it goes on to say: Any calls to getAll(), getRoots(), getRootsMeta() and getAllMeta() should be removed from your production channels.
"RokuNB" wrote:"belltown" wrote:
According to the docs, the note above getRoots() states: The following methods can be called on any subject node and return the same global results. They can be used in a development channel for debugging purposes, but should not be used in a production channel. and then it goes on to say: Any calls to getAll(), getRoots(), getRootsMeta() and getAllMeta() should be removed from your production channels.
The wisdom behind of that statement is not immediately apparent to me. It is possible that some of these functions are grossly inefficient (but ok for debug). It might be prudent then to use the previous idea of getParent() to the root.