Jump to content

Recommended Posts

Posted
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
Posted
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?

Posted

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?
 

Posted

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? 

Posted
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%")}');

 

Posted

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?

Posted

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?

Posted
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.

Posted

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.

  • 11 months later...
Posted

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...