The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

larryq (46) [Avatar] Offline
#1
Hi everyone,

I'm on chapter 5 of the book, talking about Anchor layouts, and in example 5.2 there's a listener created with some code involving an html fragment, which doesn't appear in the book.

Does anyone know what this snippet is supposed to be doing, for instance? Have I missed something here?

var htmlFrag = String.format(
'CH{0} x CW{1}
PH{2} x PW{3}
diffH{4} x diffW{5}',
height,
width,
parentHeight,
parentWidth,
heightDiff,
widthDiff
jesus.garcia (463) [Avatar] Offline
#2
Re: Example 5.2 extra code?
Hi Larry,


I'm assuming you're referring to the 5.2(additional) examples. The idea behind that htmlFrag code is to allow you to update the body of the child panels in that example code to reflect their size after layout sizing.

Add this to the window config:

defaults : { listeners : listeners }

to see what it does.
larryq (46) [Avatar] Offline
#3
Re: Example 5.2 extra code?
Thanks Jay. Not sure what happened to the formatting in my original message, as it wasn't my intent to form a single run-on sentence. I'll try your suggestion.

May I ask what the CH{0} x CW{1} stuff does?
jesus.garcia (463) [Avatar] Offline
#4
Re: Example 5.2 extra code?
Hi Larry,

The {0} is a "token". CH reports client height, and CW displays client width in this case.