Click here to Skip to main content
15,904,153 members

Comments by skfoo1 (Top 10 by date)

skfoo1 29-Apr-12 23:23pm View    
Thanks for the reasons.
The DLL was supposed to be linked and used in another MFC dialog-based project. And in this 2nd project, I've a few buttons. One button named: "Create Data". When i clicked on this button, i am supposed to bring up the plotting dialog from the DLL. And in the plotting dialog, I've a File Dialog (created when click "open" button), and 2 other dialogs(created when clicked other buttons in the plotting dialog).
skfoo1 26-Apr-12 22:03pm View    
Whats the reason for not launching dialogs from secondary threads?
skfoo1 19-Apr-12 3:14am View    
Yep, I've changed. But now the diagrams moves up when i dragged up. Think something is wrong with the panning function. gonna go check it out. Thanks for your help. :)
skfoo1 18-Apr-12 22:56pm View    
Yea, by right that should be the way. But for some reasons, dragging down nCurPos returns a positive and dragging up nCurPos returns a negative.
skfoo1 18-Apr-12 1:49am View    
I see. Thanks for your help.

I've got another question related to the slider control.

int nMinY = floor(m_dMinY);
int nMaxY = ceil(m_dMaxY);
m_nSliderVert = ((nMaxY + nMinY) / 2); // Get the middle of the range
m_slidervertical.SetBuddy(&m_ChartCtrl, FALSE);
m_slidervertical.SetRange(nMinY, nMaxY);
m_slidervertical.SetTicFreq(1);
m_slidervertical.SetPos(m_nSliderVert);

void CDlg::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{

int nEndVal = m_slidervertical.GetPos();
double Shift = (double)(m_nSliderVert + nEndVal);

m_dSliderMinYShift = m_dMinY - Shift; // m_dMinY = Current Min value of the Y-axis
m_dSliderMaxYShift = m_dMaxY - Shift; // m_dMaxY = Current Max value of the Y-axis

// Do Panning.
// Get Current Min & Max values of the Y-axes.
}


When ever i scroll up or down, the graphs will move. But after a while, the values of the Y-axis will be very large, and the graphs will be moved out of range. I've tried to use the original values of the Y-axis to calculate the shifting. But it can only works when the graphs are in the original state. If the graphs are zoomed-in, and the slider is dragged, the shifting is still using the original values which is wrong. It should be using the current Max & Min values of the Y-axis. How can i solve this problem? Hope I make the question clear. Pardon my bad English.