I create two files using bright script. Both extend in a scene so I access the second file in one file. But isn't work.
and I use one file for extend scene and another file for group It's working By below code.
m.keypanel = m.panelset.createChild("KeyboardDialogExample")
Is there any way to access it?
I maintain Focus in Up or Down key. It's working and if stay email focus then I open dialog Box to press Ok. But Giving This error. I used separately It's Successfully Work.
Actually, what is happening in the code, you are creating a "KeyboardDialogExample" child in init() function, its fine. Problem is with setting the focus for that child. Basically init() function is called immediately after parsing the respective xml file, and is used to cache Nodes and setting field observers. So this function should not be used to setfocus on another component. Second thing Group node by default is not focusable. It can be made focusable, but almost all the time it is not required, because same functionality can be achieved in another easier way. Below are my suggestions for your requirement---
m.keypanel = m.panelset.createChild("KeyboardDialogExample") m.keypanel.setFocus(true)
with
m.keypanel = CreateObject("roSGNode", "KeyboardDialogExample")
m.keypannel.visible = false
m.top.appendChild(m.keypanel)
Its a recommended way to access other components.
Now set visibility to true, on the whichever keypress event you want as-
m.keypannel.visible = true
Add visibility observer in init() function of "KeyboardDialogExample" as--
m.top.observeField("visible", "actionsToBePerformedOnVisibilityChange")
create a function with the the name "actionsToBePerformedOnVisibilityChange' (or whatever name you want to keep, change it in observeField line as well), and add the code whatever actions you want to perform on visibility of that group.
function actionsToBePerformedOnVisibilityChange()
if m.top.visible = true
'add the action code here.
end if
end function
If you want to come back from "KeyboardDialogExample" to previous, just make the
m.keypannel.visible = false
on the whichever keypress event you want and set the focus some field of main scene.
Try to code like this. after that you can hop between two files.
(Note:- You may be wondered, why we are setting visibility true and false repetitily. This is because observers generally work when there is change in value from previous one. For example, in above code, if we will not set the visibility of "keyboaddialogexample" to false in init() function of main scene, it will not observe the value when we will change it to true, because by default its true.) Hope, I answered what you was looking.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments