Controlling Size options with list on webpage

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
John
Posts: 24
Joined: Thu Aug 10, 2017 3:21 pm

Controlling Size options with list on webpage

Post by John »

Hi,

I've experimented with the various Size options when displaying a list in a web page.
Lansa Sizes 1.docx
(949.25 KiB) Downloaded 6686 times
Lansa Sizes 2.docx
(749.32 KiB) Downloaded 6944 times
What I am trying to achieve?
- I don't want the user to have to scroll the PAGE, but I am happy for them to scroll the list WITHIN the page.

- When Size: Content Height is used, a full list simply runs off the bottom of the page and the user would have to scroll the page down to see it, something I wanted to avoid.

- I want it to stay on the page and have scroll bars if the list was too long to stay on the page.

What is the best way using Size to achieve this please?
jyoung
Posts: 694
Joined: Thu Jan 21, 2016 6:43 am
Location: Oklahoma City, OK USA

Re: Controlling Size options with list on webpage

Post by jyoung »

I would put the list in another panel. Then you can enable vertical scrolling on that panel, set the sizing of the List to ContentHeightFitToWidth and the set the panel to FitToWidth.

I also turned off vertical scrolling on the page itself.

Code: Select all

begin_com role(*EXTENDS #PRIM_WEB) layoutmanager(#Layout1) verticalscroll(False)
define_com class(#PRIM_VS.Style) name(#Style1) borderbottom(1) borderbrush(#Brush1) borderleft(1) borderright(1) bordertop(1)
define_com class(#PRIM_VS.SolidBrush) name(#Brush1) color(69:0:255)

define_com class(#PRIM_VS.Style) name(#Style2) borderbottom(1) borderbrush(#Brush2) borderleft(1) borderright(1) bordertop(1)
define_com class(#PRIM_VS.SolidBrush) name(#Brush2) color(255:37:1)

define_com class(#PRIM_TBLO) name(#Layout1)
define_com class(#PRIM_TBLO.Row) name(#LayoutRow1) displayposition(1) parent(#Layout1)
define_com class(#PRIM_TBLO.Column) name(#LayoutColumn1) displayposition(1) parent(#Layout1)
define_com class(#PRIM_TBLO.Item) name(#LayoutItem1) alignment(TopLeft) column(#LayoutColumn1) manage(#Panel1) parent(#Layout1) row(#LayoutRow1) sizing(FitToWidth) flow(Down)
define_com class(#PRIM_TBLO.Item) name(#LayoutItem3) alignment(TopLeft) column(#LayoutColumn1) manage(#List1) parent(#Layout1) row(#LayoutRow1) sizing(ContentHeightFitToWidth) flow(Down)
define_com class(#PRIM_TBLO.Item) name(#LayoutItem4) alignment(TopLeft) column(#LayoutColumn1) manage(#Panel2) parent(#Layout1) row(#LayoutRow1) flow(Down) sizing(FitToWidth)

define_com class(#PRIM_TBLO) name(#Layout2)
define_com class(#PRIM_TBLO.Row) name(#LayoutRow2) displayposition(1) parent(#Layout2)
define_com class(#PRIM_TBLO.Column) name(#LayoutColumn2) displayposition(1) parent(#Layout2)
define_com class(#PRIM_TBLO.Item) name(#LayoutItem2) alignment(CenterLeft) column(#LayoutColumn2) manage(#Label1) parent(#Layout2) row(#LayoutRow2) sizing(None) marginleft(10)

define_com class(#PRIM_TBLO) name(#Layout3)
define_com class(#PRIM_TBLO.Row) name(#LayoutRow3) displayposition(1) parent(#Layout3)
define_com class(#PRIM_TBLO.Column) name(#LayoutColumn3) displayposition(1) parent(#Layout3)
define_com class(#PRIM_TBLO.Item) name(#LayoutItem5) alignment(TopLeft) column(#LayoutColumn3) manage(#List1) parent(#Layout3) row(#LayoutRow3) sizing(ContentHeightFitToWidth)

define_com class(#PRIM_LIST) name(#List1) displayposition(1) left(0) parent(#Panel2) tabposition(1) top(0) height(165) width(1198) rowheight(20)
define_com class(#PRIM_LIST.Number) name(#ColumnSTD_NUM1) columnwidth(100) displayposition(1) increment(1) parent(#List1) source(#STD_NUM) wrap(False)
define_com class(#PRIM_LIST.String) name(#ColumnSTD_STRNG1) columnwidth(1) displayposition(2) parent(#List1) source(#STD_STRNG) columnunits(Proportion)
define_com class(#PRIM_PANL) name(#Panel1) displayposition(1) left(0) parent(#COM_OWNER) tabposition(1) tabstop(False) top(0) width(1200) style(#Style1) height(100) layoutmanager(#Layout2)
define_com class(#PRIM_LABL) name(#Label1) caption('Header Panel') displayposition(1) ellipses(Word) height(25) parent(#Panel1) tabposition(1) tabstop(False) top(37) verticalalignment(Center) width(120)
define_com class(#PRIM_PANL) name(#Panel2) displayposition(2) left(0) parent(#COM_OWNER) tabposition(2) tabstop(False) top(100) style(#Style2) height(250) width(1200) layoutmanager(#Layout3) verticalscroll(True)

evtroutine handling(#Com_owner.Initialize)
define_com class(#PRIM_NMBR) name(#count)

#count := 1

dountil cond(#count > 100)
#STD_NUM := #count
#STD_STRNG := "Some String"
add_entry to_list(#List1)
#count += 1
enduntil
endroutine

end_com
Capture.PNG
Capture.PNG (26.83 KiB) Viewed 17847 times
The difficultly may come in controlling the size of the containing panel. Being set FitToWidth, you are essentially fixing the height with may not be what you want.

There may be a better way to do it.

Hope this helps,
Joe
Kingston
Posts: 51
Joined: Tue Aug 08, 2017 5:25 pm

Re: Controlling Size options with list on webpage

Post by Kingston »

Thanks Joe, that worked great.

I was expecting that Content Height would respect the layout row boundaries. We had Content Height set for our list so that we didn't have all the blank rows showing but once it got too long it ran off the bottom of the screen, way past the next row. Enclosing it in a Panel kept it contained and allowing Vertical Scroll on the Panel allowed us to scroll. Very clever.

I guess I shouldn't have expected the layout to contain something set to "Content Height" as obviously that's the purpose of "Fit to Height". But "Fit to Height" also displayed empty rows all the way to the bottom of the row and I didn't want that

Anyway, thanks for the help
Kingston
Posts: 51
Joined: Tue Aug 08, 2017 5:25 pm

Re: Controlling Size options with list on webpage

Post by Kingston »

Oh except your list header scrolls off the page. I guess that is why you included a separate header outside the panel.
jyoung
Posts: 694
Joined: Thu Jan 21, 2016 6:43 am
Location: Oklahoma City, OK USA

Re: Controlling Size options with list on webpage

Post by jyoung »

I did not think about the list header. I was trying to indicate multple panels are at play. I thought there was a way to fix the header but I can't remember what it is.
Kingston
Posts: 51
Joined: Tue Aug 08, 2017 5:25 pm

Re: Controlling Size options with list on webpage

Post by Kingston »

It may be I'm overdoing this.

We can achieve the look we want without all this mucking around IF we don't apply a non white ThemeDrawStyle for every second column. If we leave each column white, then the native way the List box works looks fine using even Fit Both. But when we apply a Alternate Style for each column (so that columns alternate white and blue) then the blue columns continue down below that part of the list that has data in it. And I was wanting to not have that happen when the list was not full.

So perhaps there is a way to not have the ThemeDrawStyle apply when that row has no data? Fill that part of the layout with a list but don't apply that Column's ThemeDrawStyle below the area that has list data in it. Does that sound like something that might be possible?
Kingston
Posts: 51
Joined: Tue Aug 08, 2017 5:25 pm

Re: Controlling Size options with list on webpage

Post by Kingston »

What I want most of all though is "Control Vertical Size by Content Up to a Maximum of the Size of the Row that Contains the List then Contain it Within the Row and Display Scroll Bars". :D
atostaine
Posts: 696
Joined: Wed Jan 20, 2016 7:38 am

Re: Controlling Size options with list on webpage

Post by atostaine »

I'm not in front of my machine to confirm, but I think if you set the list to fit to both, it would show a scroll bar.

Here is a screen print....
screen_list.png
screen_list.png (53.84 KiB) Viewed 17776 times
Art Tostaine
Kingston
Posts: 51
Joined: Tue Aug 08, 2017 5:25 pm

Re: Controlling Size options with list on webpage

Post by Kingston »

Thanks Atostaine, Fit to Both does show a scroll bar but when there aren't enough records to fill the entire row of the Layout that the List is in, the List displays the Alternate Column styling below the data filled rows and it shows a border around the entire list including the empty space. I wanted to not show that styling when there were no records in that area. Basically have it work like Fit to Content Height but once it had enough records to get to the bottom of the Layout Row, stop there and add scroll bars, so that the List never went below the bottom of the webpage.

What we have now managed to do is control the Alternate Column Styling programmatically so that it sets the styling only on those records that have data. That still shows an empty border but we can live with it (you can turn Border off but then you end up with Rows that have no line on the left of the first column.)
Post Reply