cristallium commented on issue #1193:
URL: https://github.com/apache/royale-asjs/issues/1193#issuecomment-1102221939

   Hi Hiedra,
   
   Thanks for your feed back, and sharing your code.
   I believe that `TileHorizontalLayout`  can be use in 2 contexts : 
   
   - `scroll `context like `j:List` or `j:ScrollableSectionContent`
   - no scroll context like `j:SectionContent` or like in the exemple of TDJ 
(in this case the container height grow with number of children).
   Here is a screenshoot of TDJ : (hostComponent.containsClass("scroll") would 
be false)
   
   
![image](https://user-images.githubusercontent.com/6851433/163946258-207ed64e-3ae8-4b65-9627-5657d0009d97.png)
   
   So I think that to have the same behavior in a no scroll context the check 
of `scroll `class is needed.
   
   Here are my last thoughts : 
   
   Actually `TileHorizontalLayout `is usable in a no scroll context but is 
useless in a scroll context because of wrong `margin-right` compute. 
   
   Getting scrollbar width is not obvious. I read some posts like 
[https://stackoverflow.com/questions/13382516/getting-scroll-bar-width-using-javascript](https://stackoverflow.com/questions/13382516/getting-scroll-bar-width-using-javascript)
 but this seem very tricky  and a sort of hack method. So  Option 2 is 
certainly a bad way except if there is an easy and obvious way to get scrollbar 
width. (But in this case, it need also to fix the refresh of layout in case of 
resize)
   
   When we do an Apache Royale app, we know (or can set by css) the scrollbar 
width. 
   So I think that Option1 is a good way but with another upgrade : we could 
add a propertity like `vscrollBarWidthReserve` (or another name). So we could 
use this way : 
   
   ```
       <j:List localId="lst" className="ImageListItemRenderer"  width="400" 
includeIn="loaded">
           <j:beads><j:TileHorizontalLayout vscrollBarWidthReserve="16" 
columnWidth="186" rowHeight="91" itemsExpand="false" horizontalGap="0"   
/></j:beads>
       </j:List>
   ```
   
   And on TileHorizontalLayout side : 
   
   ```
   if (hostComponent.containsClass("scroll") ==  true){
                                        //Reserve some room for VScrollbar
                                        adjustedHostWidth -= 
_vscrollBarWidthReserve; //take VScrollbarsize into account 
                                }
   ```
   So modification is minor and TileHorizontalLayout can be use in a scroll 
context.
   
   What do you think about this solution ?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to