dkeene Posted May 15, 2020 Share Posted May 15, 2020 Hello All I am using uniMemo and I set the text, adjust the font, height color, etc, and it displays correctly once. Any changes programatically to the Font, Size, Color, etc, are not refreshed. I tried Repaint, Update, Refresh, and while the text updates, the Font/Color etc. do not. I tried varying the size of font, etc., but it does not seem to repaint with the new font characteristics. Am i Missing something? Also, despite using the following: Self.uniMemo1.JSInterface.JSAddListener('afterrender', 'function(){this.inputEl.setStyle("line-height", this.inputEl.getStyle("font-size"))}'); as per a suggestion in the forum, the font text overlaps with multiple rows, or the first row is cut off. i would prefer a solution that does not rely upon css jscript touch-up... Any suggestions? Thank you doug Link to comment Share on other sites More sharing options...
Sherzod Posted May 15, 2020 Share Posted May 15, 2020 2 minutes ago, dkeene said: I am using uniMemo and I set the text, adjust the font, height color, etc, and it displays correctly once. Any changes programatically to the Font, Size, Color, etc, are not refreshed. I tried Repaint, Update, Refresh, and while the text updates, the Font/Color etc. do not. I tried varying the size of font, etc., but it does not seem to repaint with the new font characteristics. Am i Missing something? Hello, Can you please make a simple testcase for reproduce? Link to comment Share on other sites More sharing options...
dkeene Posted May 15, 2020 Author Share Posted May 15, 2020 Here I set the Font of the control, "umLabelTextEditor": function TToolPaletteForm.MSetScreenFont(aFont: TuniFont): integer ... Self.umLabelTextEditor.Text:='hello'+intToStr(trunc(100*random)); Self.umLabelTextEditor.Font.Size:=55; Self.umLabelTextEditor.JSInterface.JSAddListener('afterrender', 'function(){this.inputEl.setStyle("line-height", this.inputEl.getStyle("font-size"))}'); Self.umLabelTextEditor.Font.Size:=aFont.Size; Self.umLabelTextEditor.Update; Self.umLabelTextEditor.Repaint; i dont think i was adding the JSInterface.JSAddlistener correctly. do i add this each time the font is changed? Link to comment Share on other sites More sharing options...
dkeene Posted May 15, 2020 Author Share Posted May 15, 2020 I set the following on FormCreate Self.umLabelTextEditor.JSInterface.JSAddListener('afterrender', 'function(){this.inputEl.setStyle("line-height", this.inputEl.getStyle("font-size"))}'); So in use, when I set the Font to something different, say Tahoma, size=24, Color=clGreen, etc., the text changes, but the font, size, color, etc., does not change and the line height is overlapping. Should this be called each time the font is change? Link to comment Share on other sites More sharing options...
Sherzod Posted May 15, 2020 Share Posted May 15, 2020 4 hours ago, dkeene said: I set the following on FormCreate Self.umLabelTextEditor.JSInterface.JSAddListener('afterrender', 'function(){this.inputEl.setStyle("line-height", this.inputEl.getStyle("font-size"))}'); This is correct. 4 hours ago, dkeene said: i dont think i was adding the JSInterface.JSAddlistener correctly. do i add this each time the font is changed? Yes, it's wrong. OK, try this on OnCreate and once: UniMemo1.JSInterface.JSAddListener('afterrender', 'function(){this.inputEl.setStyle("line-height", "100%")}'); Link to comment Share on other sites More sharing options...
dkeene Posted May 15, 2020 Author Share Posted May 15, 2020 Thank you. The line height seems better with this, but still, the font size does not change when the umLabelTextEditor.Font.Size is changed. Do you have a suggestion? Link to comment Share on other sites More sharing options...
dkeene Posted May 15, 2020 Author Share Posted May 15, 2020 it seems that, by experimentation, the uniLabel, uniMemo (at least) only change font when the font size is >=9. While Size 8 seems to be displayed as a default, the control can't be "set" to size 8. Is this by design? Link to comment Share on other sites More sharing options...
dkeene Posted May 15, 2020 Author Share Posted May 15, 2020 actually, it does show every size EXECPT 8... when it's set to 8, it does not update the control. Link to comment Share on other sites More sharing options...
Sherzod Posted May 15, 2020 Share Posted May 15, 2020 1 hour ago, dkeene said: actually, it does show every size EXECPT 8... when it's set to 8, it does not update the control. OK, we will check this. Link to comment Share on other sites More sharing options...
dkeene Posted May 15, 2020 Author Share Posted May 15, 2020 Thank you. Please, while you're checking this, please try setting "underline" and "strikeout" to the control. once a font is Underlined or strikeout=true, updating the font will not get rid of the strikeout or underline. Link to comment Share on other sites More sharing options...
vbdavie Posted May 8, 2021 Share Posted May 8, 2021 Any solution for changing the font size at run-time? Using the addlistener works great if you will NEVER change the font size during the execution of the program. But what if I want a ZOOM button so that the user can increase the font size each time they click the zoom button? My font gets bigger and bigger BUT they start to do the overlapping lines issue. Thanks DAvie Link to comment Share on other sites More sharing options...
Sherzod Posted May 8, 2021 Share Posted May 8, 2021 Hello, We will check. Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now