Using Designs PRIM_TREE

This Q&A forum allows users to post and respond to "How Do I Do ....." questions. Please do not use to report (suspected) errors - you must use your regional help desk for this. The information contained in this forum has not been validated by LANSA and, as such, LANSA cannot guarantee the accuracy of the information.
Post Reply
atostaine
Posts: 394
Joined: Wed Jan 20, 2016 7:38 am

Using Designs PRIM_TREE

Post by atostaine » Fri Dec 16, 2016 8:09 am

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
Art Tostaine

dannyoorburg
Posts: 152
Joined: Mon Jan 04, 2016 9:50 am
Location: Australia

Re: Using Designs PRIM_TREE

Post by dannyoorburg » Fri Dec 16, 2016 11:05 am

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

atostaine
Posts: 394
Joined: Wed Jan 20, 2016 7:38 am

Re: Using Designs PRIM_TREE

Post by atostaine » Fri Dec 16, 2016 6:43 pm

thanls. i will give it a try
Art Tostaine

User avatar
Stewart Marshall
Posts: 417
Joined: Thu Nov 05, 2015 5:25 pm

Re: Using Designs PRIM_TREE

Post by Stewart Marshall » Fri Dec 16, 2016 9:30 pm

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
Stewart Marshall

Independent IT Consultant
www.marshallfloyd.com.au

atostaine
Posts: 394
Joined: Wed Jan 20, 2016 7:38 am

Re: Using Designs PRIM_TREE

Post by atostaine » Sat Dec 17, 2016 2:08 am

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.
Art Tostaine

User avatar
Stewart Marshall
Posts: 417
Joined: Thu Nov 05, 2015 5:25 pm

Re: Using Designs PRIM_TREE

Post by Stewart Marshall » Wed Dec 21, 2016 7:39 pm

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.
Stewart Marshall

Independent IT Consultant
www.marshallfloyd.com.au

atostaine
Posts: 394
Joined: Wed Jan 20, 2016 7:38 am

Re: Using Designs PRIM_TREE

Post by atostaine » Thu Dec 22, 2016 1:31 am

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
Art Tostaine

Post Reply