Jump to content

UniMemo not updating correctly


dkeene

Recommended Posts

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

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

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

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

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

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

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

  • 11 months later...

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

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...