Remove screen items
Hello all,
I'm trying to keep this corona thread going and trying to hack my way through creating a corona app to work with the HAH.
I have an app with a main and 2 'views'
This is probably going to be answered by Brett :)
I have a floorplan image on view 1.
That clears when I move to view2 and the buttons appear with the current RF status and the temps etc. but when I move back to view1 the buttons are still there. I have tried storyboard.removeScene("view2") and various other options but the buttons are still visible
I had a similiar problem, but did solve it, can'r remember how right now but perhaps if I could look at your code it might jog my memory. If you're happy to post your code so that others can have a look zip the whole project so the assets are included. Or I code give you mine, it's quite some time since I did any work on it, but it works well as a skeleton.
Karl
Hi Mark,
I'll have a look at your code tonight, I think my code does what you want, but when zipped it's a little too big to upload so I'll send you a seperate link. Hopefully you can read it, I've tried to make it structured. Be aware, this is very much a work in progress. I'm trying to base it on the LightWave app, as you 'enter' a new room I want you to be able to configure devices in it and set 'moods'.
Like you, I started with the interface, I might now continue to look at the data structure and try to complete the program. The problem I had with Corona was the difficulty in having an input text field.
Hope it helps,
Karl
Mark I modified this code and I think it does what you want now. Give it a try.
The issue was the UI creator where not returning an object and this object needs to be put inside a group, which you also were not doing. I really need to continue working on this framework don't I?
Brett
Attachment | Size |
---|---|
MultiScene_2.zip | 839.77 KB |
Brett,
Thanks for updating the code that works fine with Mark's program. I'm trying to integrate your routines into something I'm working on and am struggling to understand something.
Taking the following :-
-- UI helper functions
function toggle(v, xpos, ypos)
v.x = xpos
v.y = ypos
v.size = v.size or 20
v.default = v.default or "images/glossy_button_red.png"
v.on = v.on or "images/glossy_button_green.png"
bsc.newToggle(v)
end
local toggleRelay2 = {
c=toggle,
defaultSrc = "images/glossy_button_red.png",
overSrc = "images/glossy_button_green.png",
default = defaultSrc,
on = overSrc,
x = 80,
y = 240,
size = 16,
text="Relay 2",
xapSource="dbzoo.livebox.Controller:relay.2", size=16
}
Why does this work in terms of putting the toggle on the screen :-
toggle(toggleRelay2, 80, 320)
But this doesn't put the toggle on the screen, (screenGroup is defined) :-
screenGroup:insert(toggle(toggleRelay2, 80, 320))
It give this error :-
Runtime error
...rl\documents\corona projects\xapui\scripts\room1.lua:152: ERROR: table expected. If this is a function call, you might have used '.' instead of ':'
stack traceback:
[C]: ?
[C]: in function 'insert'
...rl\documents\corona projects\xapui
I hope I've given you enough information.
Thanks
Karl
Karl,
You're problem is the toggle() function is not returning an object. If you look carefully at the code I modified for Mark I made more than just a single change. Examine bsc.lua and main.lua for additional changes apart from the obvious one in view2.lua.
Brett
Same issue here Mark, read a few storyboard guides but yet to figure this one out