Remove screen items

9 replies [Last post]
mark_baldwin
Offline
Blackburn, United Kingdom
Joined: 19 May 2012

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

AndrewJ
Offline
United Kingdom
Joined: 22 Nov 2012
Same issue here Mark, read a

Same issue here Mark, read a few storyboard guides but yet to figure this one out

BoxingOrange
Offline
United Kingdom
Joined: 11 Jun 2010
Similiar App

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

mark_baldwin
Offline
Blackburn, United Kingdom
Joined: 19 May 2012
Here is one of the attempts

Here is one of the attempts that has the sticky objects

You'll have to change the ip address of your HAH for it to run on your system (and also the labels for the roomnodes)

Karl if you could add your code too, it would help us all.

Thanks

Mark

AttachmentSize
MultiScene_2.zip 977.08 KB
BoxingOrange
Offline
United Kingdom
Joined: 11 Jun 2010
Scenes

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

brett
Offline
Providence, United States
Joined: 9 Jan 2010
Multiple scenes

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

AttachmentSize
MultiScene_2.zip 839.77 KB
BoxingOrange
Offline
United Kingdom
Joined: 11 Jun 2010
Corona UI Extension

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

mark_baldwin
Offline
Blackburn, United Kingdom
Joined: 19 May 2012
I can move on now...

Thanks Brett, I can move on with the code now. I know my code was messy but I had tried to keep it pretty but that didn't work, so it was time to get dirty :)

Karl, I could do with having a look at the code you are working on so we don't work in parallel but work together.

This thread is now looking a bit healthier. 

 

I've also had a look at Gideros which is a similar SDK but doesn't have the backing just yet

Thanks again Brett and Karl

mark_baldwin
Offline
Blackburn, United Kingdom
Joined: 19 May 2012
And yes Brett, you need to

And yes Brett, you need to keep working on this :)

brett
Offline
Providence, United States
Joined: 9 Jan 2010
Karl,You're problem is the

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

Hardware Info