View Full Version : move view into another view
bruce
09-29-2006, 03:59 PM
I have a view that is external to a list. It contains details that are displayed. The clipping isn't quite right since its outside of the real view.
Can I assign a view to the list of subviews of a view to have it do clipping correctly? (say that 3 times fast :) )
Thanks,
Bruce
jks_pdx
10-03-2006, 08:35 AM
Although you could push a view onto the subviews array, I wouldn't recommend this. I think you would just confuse OpenLaszlo.
I don't think that there is a way to declaratively create a view with a different parent than the one it has in the xml structure.
It is quite easy to do this at run time however.
Use syntax like:
new myClass( 'parent', {x:'12', name:'myview'} );
This allows you to create a new instance of 'myClass' as a child of 'parent', with whatever initial values you specify in the second parameter.
This technique allows you to easily insert an extra view into a list. Note however, that events and handlers are not treated the same way for objects created at run time.
Take the example:
new myClass( 'parent', {onclick:'this.doStuff()'} );
This will not create a working onclick handler as you would expect. You will need to create and register delegates by hand.
bruce
10-03-2006, 10:08 AM
Thanks for the reply. I agree with it messing with laszlo. I figured that either a distructor or pooling function would get screwed up. It turned out that I didn't need to be so drastic as pushing the view inside a replicated view chain. I put it in the parent above the view containing the replicated views and used some offsets. The issue I had was having it clip 30 pixels off and I already thought I had it in the correct parent view. *sigh*
I had a few issues since the scrollbar function was outside of this view so it didn't scroll correctly either when the view was opened while scrolled.
I like the idea of doing a dynamic instantiation of the class. Assuming I can get it destroyed properly then I could work that in to reduce the memory footprint which is getting quite large. Up to 70M already. :/
Cheers
vBulletin® v3.8.4, Copyright ©2000-2012, Jelsoft Enterprises Ltd.