Hello community,
A user requested me for a multiline texbox (expandable) with a column next to it that would display the row number of each line.
Because every character type can have their own height i figured id convert the text to courrier as each character use the same height.
My problem now is when the textbox expands on multiple pages, I can't get the total height of the textbox, only the height of the textbox on the first page
Unfortunately i cannot upload the form from work for security reason but here is the code.
var txt_CompteRendu = xfa.resolveNode("formulaire1.page2.sf7.table7.row7_1.Tableau22.row2.txt71_CompteRendu");
var p2_lbl_rowCount = xfa.resolveNode("formulaire1.page2.sf7.table7.row7_1.Tableau22.row2.lbl7_LineNum");
var lblText = "";
p2_lbl_rowCount.rawValue = "";
for (var i = 1; i * 10 <= (xfa.layout.h(txt_CompteRendu, "pt")); i++) {
if (lblText != "") {
lblText = lblText + "\n";
}
lblText = lblText + i;
}
p2_lbl_rowCount.rawValue = lblText;
console.println(lblText);
xfa.layout.relayout(); // need to relayout so that if i remove lines it change the size of the row2 right away instead of having to put the focus on it again then out
the variable p2_lbl_rowCount is the text label use to display the line number.
Unfortunately if the textbox txt_CompteRendu is more than 72 lines it will expand to another page, at which point the counter will stop counting.