haxegui help please

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

haxegui help please

Tony Polinelli
I'm having a little trouble getting the ScrollPane to work as
expected. I have a Container to which i am adding my LayoutArea class
which extends ScrollPane. I want it to be able to manage adding the
content - which should then have horiz and vert scrollbars, since i am
telling it to have a size of 500,500. The issue is that the handle of
the Scrollbars does not recieve the onResize event, and so they are
well oversized (the original size of the ScrollPane before resize)
whereas the buttons DO move

package layout2d.containers;
import flash.display.DisplayObjectContainer;
import flash.display.Sprite;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.geom.Rectangle;
import haxegui.containers.ScrollPane;
import haxegui.controls.Component;
import haxegui.utils.Size;

class LayoutArea extends ScrollPane
{
        var background:Sprite;
       
        public function new (parent:DisplayObjectContainer = null,
name:String = null, ?x:Float, ?y:Float)
        {
                super (parent, name, x, y);
        }
       
        override public function init(?opts:Dynamic) {
                super.init(opts);
               
                createBackground();
               
                resize(new Size(500, 500));
        }
       
        private function createBackground():Void
        {
                background = new Sprite();
                background.graphics.beginFill(0, .1);
                background.graphics.drawRect(0, 0, 550, 550);
                addChild(background);
        }
}



--
Tony Polinelli
http://touchmypixel.com

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: haxegui help please

gershon
Extremely glad to have you using this code :)

There's a chain of onParentResize() events that should fire... 
Its a little hard answering without seeing your full hierarchy, make sure ScrollPane is attached to something that dispatches a ResizeEvent, like a Window or another Container...
Also, ScrollPane actually adds children to a child named 'content' (http://code.google.com/p/haxegui/source/browse/trunk/haxegui/containers/ScrollPane.hx#70)
So, your displaylist should look something like Window.Container.ScrollPane.content.background
Hope it helps...

On Thu, Jan 14, 2010 at 10:00 AM, Tony Polinelli <[hidden email]> wrote:
I'm having a little trouble getting the ScrollPane to work as
expected. I have a Container to which i am adding my LayoutArea class
which extends ScrollPane. I want it to be able to manage adding the
content - which should then have horiz and vert scrollbars, since i am
telling it to have a size of 500,500. The issue is that the handle of
the Scrollbars does not recieve the onResize event, and so they are
well oversized (the original size of the ScrollPane before resize)
whereas the buttons DO move

package layout2d.containers;
import flash.display.DisplayObjectContainer;
import flash.display.Sprite;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.geom.Rectangle;
import haxegui.containers.ScrollPane;
import haxegui.controls.Component;
import haxegui.utils.Size;

class LayoutArea extends ScrollPane
{
       var background:Sprite;

       public function new (parent:DisplayObjectContainer = null,
name:String = null, ?x:Float, ?y:Float)
       {
               super (parent, name, x, y);
       }

       override public function init(?opts:Dynamic) {
               super.init(opts);

               createBackground();

               resize(new Size(500, 500));
       }

       private function createBackground():Void
       {
               background = new Sprite();
               background.graphics.beginFill(0, .1);
               background.graphics.drawRect(0, 0, 550, 550);
               addChild(background);
       }
}



--
Tony Polinelli
http://touchmypixel.com

--
haXe - an open source web programming language
http://haxe.org


--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: haxegui help please

Tony Polinelli
This is baiscally the whole heirachy. I have a Container added to the
stage which holds my custom Control of LayoutArea (code in the 1st
msg) They are not inside Window Containers, as i have no need for
this. So, there are no 'resizes' happening, as there is nothing to
resize (i guess the whole stage can resize, but it shouldn't need to).
The only resize is the one called in the LayoutArea, in the init().
This is the way to set the size no? (as you couldnt use
getters/setters on native width/height)
I must be doing something wrong- but it seems logical to me ;P
I understand that addChild adds the clip to the 'content' clip, but it
should be fine to have the reference to it here.
any ideas?  I could attach full exampe code if that helps - or you
could just use the class above

I attempted to get things working in neash yesterday - but there will
be quite a few fixes to neash to get working. Also the Script manager
uses a TypedDictionary, which i dont think there is any equivelant
for- so things might need a few changes. Have you thought of
supporting neash? (c++, neko, iphone)



On Fri, Jan 15, 2010 at 9:16 AM, gershon <[hidden email]> wrote:

> Extremely glad to have you using this code :)
>
> There's a chain of onParentResize() events that should fire...
> Its a little hard answering without seeing your full hierarchy, make sure
> ScrollPane is attached to something that dispatches a ResizeEvent, like a
> Window or another Container...
> Also, ScrollPane actually adds children to a child named 'content'
> (http://code.google.com/p/haxegui/source/browse/trunk/haxegui/containers/ScrollPane.hx#70)
> So, your displaylist should look something like
> Window.Container.ScrollPane.content.background
> Hope it helps...
>
> On Thu, Jan 14, 2010 at 10:00 AM, Tony Polinelli <[hidden email]>
> wrote:
>>
>> I'm having a little trouble getting the ScrollPane to work as
>> expected. I have a Container to which i am adding my LayoutArea class
>> which extends ScrollPane. I want it to be able to manage adding the
>> content - which should then have horiz and vert scrollbars, since i am
>> telling it to have a size of 500,500. The issue is that the handle of
>> the Scrollbars does not recieve the onResize event, and so they are
>> well oversized (the original size of the ScrollPane before resize)
>> whereas the buttons DO move
>>
>> package layout2d.containers;
>> import flash.display.DisplayObjectContainer;
>> import flash.display.Sprite;
>> import flash.events.Event;
>> import flash.events.MouseEvent;
>> import flash.geom.Rectangle;
>> import haxegui.containers.ScrollPane;
>> import haxegui.controls.Component;
>> import haxegui.utils.Size;
>>
>> class LayoutArea extends ScrollPane
>> {
>>        var background:Sprite;
>>
>>        public function new (parent:DisplayObjectContainer = null,
>> name:String = null, ?x:Float, ?y:Float)
>>        {
>>                super (parent, name, x, y);
>>        }
>>
>>        override public function init(?opts:Dynamic) {
>>                super.init(opts);
>>
>>                createBackground();
>>
>>                resize(new Size(500, 500));
>>        }
>>
>>        private function createBackground():Void
>>        {
>>                background = new Sprite();
>>                background.graphics.beginFill(0, .1);
>>                background.graphics.drawRect(0, 0, 550, 550);
>>                addChild(background);
>>        }
>> }
>>
>>
>>
>> --
>> Tony Polinelli
>> http://touchmypixel.com
>>
>> --
>> haXe - an open source web programming language
>> http://haxe.org
>
>
> --
> haXe - an open source web programming language
> http://haxe.org
>



--
Tony Polinelli
http://touchmypixel.com

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: haxegui help please

gershon
About the resizing, do try and put your main Container in a Window, just to check and be sure... reason being that stage doesn't send a ResizeEvent, so it wont reach your class, if so, could try and manually call:
		container.resize() \ container.dispatchEvent(new ResizeEvent(ResizeEvent.RESIZE));
after the Container has initiated, and see if that helps...


I might have fiddled a bit with the ScrollBar class, i do remember have some issues with its handles, i'm a little afraid to update the svn, as it has'nt been for quite a while now, and might break in places...
Does the 'Example1' layout work properly with current svn (r284) ?

neash\c++ and iphone would be great targets, have'nt messed with them so much, mostly compile problems (like xml in c++, ndll's for neko, probably due to linux64...)
The TypedDictionary was Russell's doing, i guess it could work with any other weak-reference implementation...



On Fri, Jan 15, 2010 at 12:35 AM, Tony Polinelli <[hidden email]> wrote:
This is baiscally the whole heirachy. I have a Container added to the
stage which holds my custom Control of LayoutArea (code in the 1st
msg) They are not inside Window Containers, as i have no need for
this. So, there are no 'resizes' happening, as there is nothing to
resize (i guess the whole stage can resize, but it shouldn't need to).
The only resize is the one called in the LayoutArea, in the init().
This is the way to set the size no? (as you couldnt use
getters/setters on native width/height)
I must be doing something wrong- but it seems logical to me ;P
I understand that addChild adds the clip to the 'content' clip, but it
should be fine to have the reference to it here.
any ideas?  I could attach full exampe code if that helps - or you
could just use the class above

I attempted to get things working in neash yesterday - but there will
be quite a few fixes to neash to get working. Also the Script manager
uses a TypedDictionary, which i dont think there is any equivelant
for- so things might need a few changes. Have you thought of
supporting neash? (c++, neko, iphone)



On Fri, Jan 15, 2010 at 9:16 AM, gershon <[hidden email]> wrote:
> Extremely glad to have you using this code :)
>
> There's a chain of onParentResize() events that should fire...
> Its a little hard answering without seeing your full hierarchy, make sure
> ScrollPane is attached to something that dispatches a ResizeEvent, like a
> Window or another Container...
> Also, ScrollPane actually adds children to a child named 'content'
> (http://code.google.com/p/haxegui/source/browse/trunk/haxegui/containers/ScrollPane.hx#70)
> So, your displaylist should look something like
> Window.Container.ScrollPane.content.background
> Hope it helps...
>
> On Thu, Jan 14, 2010 at 10:00 AM, Tony Polinelli <[hidden email]>
> wrote:
>>
>> I'm having a little trouble getting the ScrollPane to work as
>> expected. I have a Container to which i am adding my LayoutArea class
>> which extends ScrollPane. I want it to be able to manage adding the
>> content - which should then have horiz and vert scrollbars, since i am
>> telling it to have a size of 500,500. The issue is that the handle of
>> the Scrollbars does not recieve the onResize event, and so they are
>> well oversized (the original size of the ScrollPane before resize)
>> whereas the buttons DO move
>>
>> package layout2d.containers;
>> import flash.display.DisplayObjectContainer;
>> import flash.display.Sprite;
>> import flash.events.Event;
>> import flash.events.MouseEvent;
>> import flash.geom.Rectangle;
>> import haxegui.containers.ScrollPane;
>> import haxegui.controls.Component;
>> import haxegui.utils.Size;
>>
>> class LayoutArea extends ScrollPane
>> {
>>        var background:Sprite;
>>
>>        public function new (parent:DisplayObjectContainer = null,
>> name:String = null, ?x:Float, ?y:Float)
>>        {
>>                super (parent, name, x, y);
>>        }
>>
>>        override public function init(?opts:Dynamic) {
>>                super.init(opts);
>>
>>                createBackground();
>>
>>                resize(new Size(500, 500));
>>        }
>>
>>        private function createBackground():Void
>>        {
>>                background = new Sprite();
>>                background.graphics.beginFill(0, .1);
>>                background.graphics.drawRect(0, 0, 550, 550);
>>                addChild(background);
>>        }
>> }
>>
>>
>>
>> --
>> Tony Polinelli
>> http://touchmypixel.com
>>
>> --
>> haXe - an open source web programming language
>> http://haxe.org
>
>
> --
> haXe - an open source web programming language
> http://haxe.org
>



--
Tony Polinelli
http://touchmypixel.com

--
haXe - an open source web programming language
http://haxe.org


--
haXe - an open source web programming language
http://haxe.org