I am trying to position buttons (TExtButton) using the ExtPascal library (wrappers round ExtJS) in Lazarus. I want to set the width of the buttons based on the text and font of the button. I have tried various combinations of GetWidth and JSExpression and ExtUtilTextMetrics, but the answer that comes back is something like -420,000.
It may be relevant that I was unable to get the font to change using calls like this:
JSCode('style:{"font-size":"'+ FontSize +'px","font-family":"Tahoma"}');
but the only effect I could get that way was that the button was higher if I set the font big enough, but the text of the button was rendered in the original small font.
So I resorted to putting the style into the string that gets passed to the Text property of the buttons, using this expression:
result := '<b style="font-size:1.4em;font-family=sans-serif;color:rgb(14,63,138);">' + s + '</b>'
Can anyone help me work out the exact text width?
TIA Mark