Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to set Button icons from UniCode characters?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    How to set Button icons from UniCode characters?

    Many of the NT buttons (particularly in the tool bar of the Chart window) have an icon determined by a single UniCode character set in the button's content property.

    For example, the Show Data Box button has a UniCode character of 57391 which determines its icon:
    Click image for larger version  Name:	image.png Views:	0 Size:	443 Bytes ID:	1325885
    Click image for larger version  Name:	image.png Views:	0 Size:	66.5 KB ID:	1325886

    There's also a mention of this in the NT Help https://ninjatrader.com/support/helpGuides/nt8/NT%20HelpGuide%20English.html?using_images_and_geo metry_with_custom_icons.htm

    "you can use a variety of inputs to specify what will be displayed on the icon, including UniCode characters (if they exist in the icon pack for the font family used in NinjaTrader)"

    Unfortunately, there's no example how to do this. I've tried the following (copied from the Show Data Box button), but it does not show any icon:

    Click image for larger version  Name:	image.png Views:	0 Size:	13.7 KB ID:	1325887
    What​ property setting am I missing to make this work? I'm simply trying to re-use the NT icons in my own custom button using the UniCode value, the same way that NT does it.

    #2
    Hello tcdouglas,

    Some further information can be found from the forum post below.


    I've re-posted the link as the link you have leads to a 404.
    NinjaScript > Educational Resources > Using Images and Geometry with Custom Icons
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hi Chelsea B,

      Thank you for your advice, which I'll certainly look at.

      However, I have noticed a difference between what I'm doing and what NT is doing. The FontFamily created by NT included a BaseUri that takes into account the currently selected theme:

      Click image for larger version

Name:	2024-11-27 18_09_27-MyChartAutomationAddOn (Debugging) - Microsoft Visual Studio.png
Views:	127
Size:	48.9 KB
ID:	1325906

      However, my FontFamily does not:

      Click image for larger version

Name:	image.png
Views:	114
Size:	64.9 KB
ID:	1325907

      So I think this question boils down to: How do I create a FontFamily that takes into account the currently selected theme?

      Obviously hard-coding the BaseUri is not a solution as it wouldn't change if the selected theme changes.

      Comment


        #4
        ...hmm, if I hard-code the BaseUri (so it matches the NT button), it's still not working.



        Comment


          #5
          Hello tcdouglas,

          This would be an advanced C# concept and is not fully supported by the Scripting Support team.

          There can be limitations using unsupported code and advanced C# concepts in a NinjaScript, so your mileage may vary. As of now, we do not have any examples that can be used to navigate that path.

          I asked our development about this and let me know:
          "The icons we use are a custom font we make." ... 'I don't believe they (the font file) can be accessed by clients at all."

          They have provided the font file if you find this helpful.
          NT8_IconFont.zip
          Chelsea B.NinjaTrader Customer Service

          Comment


            #6
            ...I've worked out how to do it with 1 line of code:

            Click image for larger version  Name:	2024-11-28 07_41_50-MyBarDataAddOn (Running) - Microsoft Visual Studio.png Views:	0 Size:	2.4 KB ID:	1325980



            FYI also found out you can get the icons font family with:

            Click image for larger version

Name:	image.png
Views:	105
Size:	4.9 KB
ID:	1325981​​​
            Last edited by tcdouglas; 11-28-2024, 01:48 AM.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            553 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            324 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            100 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            543 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            546 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X