Jump to content
Software FX Community

Re: changing values inside of mouse clicks


User (Legacy)

Recommended Posts

Hello,

thanks for the reply, I tried that, but the control still behaves the same.

I now get the following event chain for a right mouse butten double click

RBUTTONUP

RBUTTONDBLCLK

MYOWNMESSAGE

RBUTTONUP

Here is, in pseudo code what I am doing.

# creating control

# registering an COM object as the event sink for the control

# listening to all events, but handle only a couple of them

# in each interested event listener I tell the control not to proceed with

the message

# I also tell windows not to proceed with the message

# in RBUTTONUP I setup a timer to inform me half a sec later again about

this event, but only if there was no double click

# in RBUTTONDBLCLK I kill the timer, save the state (double click processed)

and post a message to myself

# in MYOWNMESSAGE, which is WM_USER + 1576 or WM_USER + 1577, I hittest the

chart, using the returned data to eventually change the data of the chart

completely (new number of series and new number of data points)

I still manage to crash the control when using a pie chart.

So far I figured out that, before I change the data, I have to disable the

tooltips. This will prevent the bar charts from crashing. I tried a lot of

things in order to make the pies not crashing anymore, but so far without

any luck.

As far as I know it has something to do with the events. If I trigger the

change externally everything is fine, even if the control does not get time

to redraw itself before new data is coming in. But trying the same using the

events fails.

I just can't think of any more reason, but I hope that you will have some

more ideas why this happens. I would appreciate any help on this, because we

need this feature (reacting on double clicks by changing data).

Stephan Klaffer,

DecisionWorks London

"Justin Trask" <JustinT@softwarefx.com> wrote in message

news:hpAHhOVOAHA.2128@sfxserver.softwarefx.com...

Hello,

You can only change a value of a marker but you can not change the

amount of data within a mouse event. If you want to do this you will

need to post yourself a message and reallocate the data once the event

is complete.

Justin Trask

Software FX

-----Original Message-----

From: Stephan Klaffer [mailto:stephan.klaffer@decisionworks.co.uk]

Posted At: Thursday, October 12, 2000 9:30 AM

Posted To: Server

Conversation: Another crash - but hard to reproduce

Subject: Another crash - but hard to reproduce

Hello,

I just found another situation in which the control crashes. Using

purely

COM Automation, it certainly happen in PIE charts, I believe it also can

happen DONOUGHT charts, and so far I was not able to get this error in

Bar

or line charts of any kind.

This crash happens if you listen for the LButtonDblClick und

RButtonDBLClick

events and change the data of the chart during the event handling. If

you

use a pie chart for doing so the following, very fast combination of

clicks

will crash the control. LBUTTON LBUTTON RBUTTON. As I observed the

problem,

it looks like that the control still has the the old data (not yet

displayed

the new data) while the RBUTTON event comes in. This seems to cause the

problem, but this is only an observation.

I am using VC6, and I just generated all the wrapper classes for the

ActiveX

control. Then I generated event sink handler and used the following code

to

reproduce the problem.

void CChartfxDlg::OnLButtonDblClkChart1(short x, short y, short nSerie,

long

nPoint, short FAR* nRes)

{

// TODO: Add your control notification handler code here

CChartFX *chart = (CChartFX*)this->GetDlgItem(IDC_CHART1);

chart->OpenDataEx(1, 4, 4);

chart->GetSeries().GetItem(0).SetYvalue(0, 1);

chart->GetSeries().GetItem(0).SetYvalue(1, 2);

chart->GetSeries().GetItem(0).SetYvalue(2, 3);

chart->GetSeries().GetItem(0).SetYvalue(3, 4);

chart->GetSeries().GetItem(1).SetYvalue(0, 1);

chart->GetSeries().GetItem(1).SetYvalue(1, 2);

chart->GetSeries().GetItem(1).SetYvalue(2, 3);

chart->GetSeries().GetItem(1).SetYvalue(3, 4);

chart->GetSeries().GetItem(2).SetYvalue(0, 1);

chart->GetSeries().GetItem(2).SetYvalue(1, 2);

chart->GetSeries().GetItem(2).SetYvalue(2, 3);

chart->GetSeries().GetItem(2).SetYvalue(3, 4);

chart->GetSeries().GetItem(3).SetYvalue(0, 1);

chart->GetSeries().GetItem(3).SetYvalue(1, 2);

chart->GetSeries().GetItem(3).SetYvalue(2, 3);

chart->GetSeries().GetItem(3).SetYvalue(3, 4);

chart->CloseData(1);

*nRes = 1 ;

}

void CChartfxDlg::OnRButtonDblClkChart1(short x, short y, short FAR*

nRes)

{

// TODO: Add your control notification handler code here

CChartFX *chart = (CChartFX*)this->GetDlgItem(IDC_CHART1);

chart->OpenDataEx(1, 1, 1);

chart->GetSeries().GetItem(0).SetYvalue(0, 5000);

chart->CloseData(1);

*nRes = 1;

}

void CChartfxDlg::OnRButtonUpChart1(short x, short y, short FAR* nRes)

{

// TODO: Add your control notification handler code here

*nRes = 1;

}

As I said it is very hard to do so, but possible. It also looks like

that

this may actually be easier to reproduce if the event handler took more

time. This is the case in our application - there the actions in the

event

sink handlers are bit more complicated. But since we are using our own

language I cannot post that code directly. But because I could reproduce

the

problem in VC I believe this is an problem in the control.

I hope you are able to reproduce it and then be able to fix that. It

happens

only if you click really fast. Please let me know how you proceed.

Thanks a lot in advance,

Stephan Klaffer

DecisionWorks London

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...