Page 1 of 1

Using Designs PRIM_TREE

Posted: Fri Dec 16, 2016 8:09 am
by atostaine
I have a web page that contains an RP, then a TREE, and the tree uses #Prim_Tree.iTreeDesign.

If the web page is resized, how do I get the event down to the RP for my list entries? I have the event in the list entry RP but I don't see that firing.

Thanks

Re: Using Designs PRIM_TREE

Posted: Fri Dec 16, 2016 11:05 am
by dannyoorburg
Hi,

The Tree Design is a Panel, and as such it has a SizeChanged event.

That event is NOT about the Browser changing size, if that's what's causing the confusion, but about the Panel itself changing size (probably triggered by layout managers resizing the Tree that it lives in).

If you want to know about the Web Page changing size, you'll need a reference to it, you could for instance add the following into your Tree Design:

Code: Select all

Define_Com Class(#PRIM_WEB) Name(#WebPage) Reference(*DYNAMIC)

Evtroutine Handling(#COM_OWNER.CreateInstance)
#WebPage <= #SYS_WEB.WebPage
Endroutine

Evtroutine Handling(#WebPage.SizeChanged)
#Caption1 := ("The Browser's view port size is &1 by &2").Substitute( #WebPage.Height.AsString #WebPage.Width.AsString )
Endroutine

Evtroutine Handling(#COM_OWNER.SizeChanged)
#Caption2 := ("This Design Panel's size is &1 by &2").Substitute( #COM_OWNER.Height.AsString #COM_OWNER.Width.AsString )
Endroutine
It's generally sufficient to know the PANEL is changing size though. Unless you want to trigger different UI for phone/tablet/desktop. But in that case I would have a look at the Web Page Templates on the New Web Page view. They fire events of a global application object on certain size thresholds..

Regards,
Danny

Re: Using Designs PRIM_TREE

Posted: Fri Dec 16, 2016 6:43 pm
by atostaine
thanls. i will give it a try

Re: Using Designs PRIM_TREE

Posted: Fri Dec 16, 2016 9:30 pm
by Stewart Marshall
Hi Art

VL also has a Designs feature (http://docs.lansa.com/14/en/lansa012/co ... 2_0060.htm)

These can be used to set up your application to handle multiple sizes. Most important here is that the DesignChanged event will fire on every reusable part instance at runtime.

This thread might help http://vlforum.lansa.com.au/viewtopic.php?t=14

Regards

Re: Using Designs PRIM_TREE

Posted: Sat Dec 17, 2016 2:08 am
by atostaine
Thanks Stewart. Currently I'm not able to see debug breakpoints on designchanged in my Tree item RP. I'm still making sure that it's not something else causing the problem.

Re: Using Designs PRIM_TREE

Posted: Wed Dec 21, 2016 7:39 pm
by Stewart Marshall
Did you get it to work Art?

I was tinkering today (for peace of mind) and spent 15 minutes being very confused by the event not firing on the items at start up. Eventually I realised that thanks to async processing, they weren't added until after long initialization had finished.

Always easy when you know.

Re: Using Designs PRIM_TREE

Posted: Thu Dec 22, 2016 1:31 am
by atostaine
Yes I did. I also discovered if I set a minimum width on the only row at (say) 500, my design change won't fire if It's set to < 500. Which is good if you know :D