Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Add "interactor" (expand/collapse button (Read 4624 times)
Michael Pfeifer
YaBB Newbies
*
Offline



Posts: 22
Joined: Mar 24th, 2006
Add "interactor" (expand/collapse button
Apr 12th, 2006 at 6:39am
Print Post  
Hello all,

I was once in the "unlucky" situation of being forced to catch and handle the WM_RBUTTONDOWN button message in a PreTranslate method of a CFormView derived class.
This causes the "expand" and "collapse" events to not fire any more after a right click on the expand/collapse button of a box.
Now I had the problem to perform a hit test and check on my own whether the user hit an expand/collapse button of a box or whether he just clicked anywhere else.
While there is a hit test for boxes (GetBoxAt) there is none for a box' collapse/expand button. So I changed FlowCharts source to offer such a hit test.
Since there might be others coming into this situation as well this hit test might find its way into the official FlowChart version.
Below I describe the additional code that I added.

Regards,
Michael

*** file FlowChart.idl:
[id(257), helpstring("Gets the box with an interactor at specified location")]
HRESULT GetBoxWithInteractorAt([in] LONG docX, [in] LONG docY, [out,retval] IBoxItem** ppFoundBox);

*** file FlowChart.h:
STDMETHOD(GetBoxWithInteractorAt)(LONG docX, LONG docY, IBoxItem** ppFoundBox);
CBox* BoxWithInteractorAtPos(int x, int y);

*** file FlowChartCtrl.cpp:
STDMETHODIMP CFlowChart::GetBoxWithInteractorAt(LONG docX, LONG docY, IBoxItem** ppFoundBox)
{

CBox* pFoundBox = NULL;


// search for the box

pFoundBox = BoxWithInteractorAtPos(docX, docY);


if (pFoundBox && ppFoundBox)


return pFoundBox->GetComItemQI(ppFoundBox);


return S_FALSE;
}
CBox* CFlowChart::BoxWithInteractorAtPos(int x, int y)
{

CBox* pBox = NULL;


POINT pt = {x, y};


//search the bounding rectangle of interactor

item_reviter ri;

for (ri = m_vZOrder.rbegin(); ri != m_vZOrder.rend(); ++ri)

{


if ((*ri)->GetType() == IT_BOX && (*ri)->ptInInteractor(pt) && !(*ri)->notInteractive())


{



//found



pBox = (CBox*)*ri;



break;


}

}


return pBox;
}
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Add "interactor" (expand/collapse bu
Reply #1 - Apr 12th, 2006 at 6:47am
Print Post  
Hello Michael,

Ok thank you, we will add it to the official version.

Stoyan
  
Back to top
 
IP Logged
 
Michael Pfeifer
YaBB Newbies
*
Offline



Posts: 22
Joined: Mar 24th, 2006
Re: Add "interactor" (expand/collapse bu
Reply #2 - Apr 12th, 2006 at 9:02am
Print Post  
Stoyan,

thank you very much. I really appreciate your responsiveness.

Regards,
Michael
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint