Open spektro37 opened 4 years ago
Strange but your code works fine for me.
public class MyWindow : ActiveWindow
{
public override void InitWindow()
{
// window parameters
SetParameters("MyWindow", "MyWindow", 300, 300);
TextEdit textEdit = new TextEdit();
textEdit.SetFont(DefaultsService.GetDefaultFont(5));
textEdit.SetSubstrateText("Placeholder");
textEdit.SetSubstrateFontStyle(FontStyle.Regular);
textEdit.SetSubstrateFontSize(5);
textEdit.SetHeightPolicy(SizePolicy.Fixed);
textEdit.SetHeight(5);
AddItem(textEdit);
}
}
Result:
But I do not understand why do you set font size to 5?))
May be I do not understand your question... Do SetFontSize(), SetFont() and SetSubstrateFontSize() have no effect in your demo app?
May be you are confused that I used SetFont(DefaultsService.GetDefaultFont(5)) instead of SetFontSize(5). I did that only to show that there is class-service DefaultService that could be useful.
Have tried to use TextEdit.SetFontSize() the same way I have used it with the Label element, but when I have looked at the Mimic example I found that SetFont() and SetSubstrateFontSize() are used instead. It is a bit unexpected that SetFontSize() is available, but has no effect. In fact, using SetFont() and SetSubstrateFontSize() also had no effect. :)
Have tried manipulating font size in the code below:
Could you please let me know if I am missing something in my code?