Main Site Documentation

° degree in text of textbox


#1

Hi,

how can I show ° (degree) in the textbox. I want to show it as text.
I solved this issue when I used display.simplegraphics.displaytext with holding Alt-key and then pressing 0176 or used the tiny tool. But what now?

Thanks!


#2

Could you provide a minimal example of your code for glide that will only show where you have an issue so we can test it as well.


#3

In my window I have this textbox:

Now I want to replace “Test” by the temperature that my sensor delivers and show it with °C.
I use the method of the sensor module, that measure continously every few seconds (but that’s not important here). I try to update the value in the textbox.

temp String;
temp = temperature.ToString(); //temperature is double from the sensor

GHIElectronics.NETMF.Glide.UI.TextBox TempAnzeige = (GHIElectronics.NETMF.Glide.UI.TextBox)window.GetChildByName(“TempAnzeige”);
TempAnzeige.Text = temp + “°C”;
TempAnzeige.Invalidate();

The code works but the ° is shown as a rectangle.


#4

You need to regenerate the font you are using with that textbox to include ° symbol


#5

and how can I do this?


#6

Can I add the generated fonts in the xml-file??

There is only Font=“8”


#7

Take a look at the Glide source code

http://netmfglide.codeplex.com/SourceControl/latest#Glide/Resources/droid_reg09.tinyfnt

It has 10 fonts of different sizes that you can use. I think Font=“8” corresponds to droid_reg08.tinyfnt

If you replace that file with your generated font file of size 8 that has the ° symbol and recompile glide you should be able to see it in your application.


#8

To be sure I generated the font again including °. Then I replaced the file droid_reg08.tinyfnt in Glide – Resources by the generated file without changing the name.
When I select in widow text file in VS 8 as font (so nothing changed), I still get the rectangle. I created a new project to be sure that the right dll is imported.


#9

Double check if your Tinyfont converter has the checkboxes… well, checked :slight_smile:
https://www.ghielectronics.com/community/forum/topic?id=11992

I’ve used degree symbol before, so it definitely has to work.


#10

I did it how you show on the screenshot in the other post. The problem was to say in the window file in Visual Studio which font he should use. Window file: What means Font=“8”? Resources in the fodler are attached. I replaced droid_reg08.tinyfnt by the generated font but that didn’t work. I solved the issue with this code: GHIElectronics.NETMF.Glide.UI.TextBox TextBOX = (GHIElectronics.NETMF.Glide.UI.TextBox)window.GetChildByName(“TemperaturAnzeige”); TextBOX.Font = Resources.GetFont(Resources.FontResources.ArialStandard48); TextBOX.Text = “XY°°”; TextBOX.Invalidate(); May be not the best solution but it works