ChartCustomDraw.ReDraw() not fired from event functions

Questions about MultiCharts .NET and user contributed studies.
gbulle
Posts: 14
Joined: 18 Apr 2014
Has thanked: 2 times
Been thanked: 2 times

ChartCustomDraw.ReDraw() not fired from event functions

Postby gbulle » 16 Apr 2015

Hello,

I am developing a custom indicator.
ChartCustomDraw.ReDraw() works fine when called from
CalcBar() or from OnMouseEvent().

I have a ChartToolBar too containing several buttons; when I click a button
I enter into functions like this:

private void button1_Clear_Levels(object sender, EventArgs e)
{
ChartCustomDraw.ReDraw();
}

The problem is that ChartCustomDraw.ReDraw() is not fired when called from event functions.


Tx

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: ChartCustomDraw.ReDraw() not fired from event functions

Postby Henry MultiСharts » 16 Apr 2015

Hello gbulle,

That is expected behavior. ChartCustomDraw.ReDraw() can only be called from the main calculation thread, while ChartToolBar will call the button1_Clear_Levels function in a different thread.

gbulle
Posts: 14
Joined: 18 Apr 2014
Has thanked: 2 times
Been thanked: 2 times

Re: ChartCustomDraw.ReDraw() not fired from event functions

Postby gbulle » 16 Apr 2015

Thanks,

no trick to force a redraw?
I can raise a flag and use a timer ?


Tx

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: ChartCustomDraw.ReDraw() not fired from event functions

Postby Henry MultiСharts » 22 Apr 2015

I can raise a flag and use a timer ?
You can do that.


Return to “MultiCharts .NET”