Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Draw.TextFixed use in onRender

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

    Draw.TextFixed use in onRender

    Hello, for reference i asked this question back in the beta at following link



    and was answered as follows

    You should find no problem working with both NinjaScript drawing methods and SharpDX drawing methods within OnRender, and you can access any of the NinjaScript drawing objects' properties from within OnRender, as well.

    The big distinction here is that SharpDX drawing requires a RenderTarget, and OnRender provides a ready-made RenderTarget for you. Thus, you will want to do your SharpDX work within that event. NinjaScript drawing methods (Draw.X) have no such requirement, and are already connected to logic related to slot indexes and the x- and y-axis, so you can call them in a greater scope.

    The question i have now ... with on going issues and particulars of onrender and ensuring the correct methods and onrender target being set and use of brushes...

    I have this call in an onRender() which i am reviewing ...


    myTFVOLUME = Draw.TextFixed(this, "currentbarvol", volarray..BAVolume.ToString(), TextPosition.BottomRight);

    now generally this has not been an issue but today it threw out a

    Failed to call OnRender() for chart object 'Fixed text' : attempted to read or write protected memory ...

    so this is the only draw.xxx i use all others are RenderTarget.DrawText(str,tf_s.... methods.

    So in the light of the prior post and link where intermixxed was advocated as being fine .. is it still the case and i should only use the RenderTarget.DrawText method

    any update or insight appreciated

    thanks

    #2
    Hello soulfx,

    Thanks for opening the thread.

    We recommend using the OnRender() override to do your own custom rendering or modifying properties of NinjaScript created draw objects, not necessarily to call Draw methods.

    When the method is called, drawing objects will call OnRender() within their own script. Since you are using Draw.TextFixed(), I would not expect that you would need to call this method to update positions each time OnRender() is called. I would advise to call this from OnBarUpdate() instead.

    It is intended that you can use OnRender() to update properties of the the draw object, however. For example, you could use OnRender() to update the Anchors of the draw object.

    Please let me know if I can be of further help.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    558 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
    101 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    546 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    547 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X