ObjectARX

Reply
Distinguished Contributor
421232206
Posts: 159
Registered: ‎10-21-2010
Message 1 of 6 (166 Views)

about modeless dialog used in autocad

166 Views, 5 Replies
09-04-2013 03:28 AM

in the attachments, there is a video about my problem. it is not easy to express, so I recorded this video. 

in the video, you can find that, the dialog in the bottom of the CAD frame, is a modeless dialog.  First, I select a line in the viewport, then I click a button in this dialog,  I guess now the focus is on this dialog. then I double click the item of the listview in the dialog. I intened to position a line in the viewport,  you can see, I have zoomed to the line, in  my code, I have selected the line,too.

    void MakeEntsSelected(ads_name ssName)
    {
        acedSSSetFirst( NULL , NULL );
        int es=acedSSSetFirst(ssName,NULL);
    }

 the function above is the code used to make entities selected by code.   but you can see that ,only if  I clicked the viewport, then the entities show selected. it seems that the viewport do not get focus. I have used functions like ,

    actrTransactionManager->flushGraphics();
    acedUpdateDisplay(); 

but it does not work.

Technology change world! Coding change technology! We coders are coding!
Distinguished Mentor
owenwengerd
Posts: 594
Registered: ‎08-06-2002
Message 2 of 6 (155 Views)

Re: about modeless dialog used in autocad

09-04-2013 07:13 AM in reply to: 421232206

I what context is your MakeEntsSelected() function executing? It should be in a document context command handler. In some cases, it might work outside the document context if you set focus to the document window then send a WM_MOUSEACTIVATE message:

PostMessage( hwndDoc, WM_MOUSEACTIVATE, 0, MAKELPARAM(HTCLIENT,WM_LBUTTONDOWN) );

 

--
Owen Wengerd
ManuSoft
Distinguished Contributor
421232206
Posts: 159
Registered: ‎10-21-2010
Message 3 of 6 (140 Views)

Re: about modeless dialog used in autocad

09-04-2013 06:14 PM in reply to: owenwengerd

like this,     PostMessage( curDoc(), WM_MOUSEACTIVATE, 0, MAKELPARAM(HTCLIENT,WM_LBUTTONDOWN) );

but it can not be compiled and error come out,

error C2660: “CWnd::smileytongue:ostMessageW” do not accept four parameters.

I am sure that MakeEntsSelected() has been executed.

Technology change world! Coding change technology! We coders are coding!
Distinguished Mentor
owenwengerd
Posts: 594
Registered: ‎08-06-2002
Message 4 of 6 (136 Views)

Re: about modeless dialog used in autocad

09-04-2013 07:11 PM in reply to: 421232206

If you want to call CWnd:: PostMessage(), you'll need to change the arguments accordingly.

--
Owen Wengerd
ManuSoft
Distinguished Contributor
421232206
Posts: 159
Registered: ‎10-21-2010
Message 5 of 6 (131 Views)

Re: about modeless dialog used in autocad

09-04-2013 08:26 PM in reply to: owenwengerd

//position a feature.
void CFeaturePropDlg::smileysurprised:nBnClickedBtnPosFeature()
{
    CMineFeature* pMF = GetCurrentMineFeatureProp();
    if (NULL == pMF) return;

    PosFeature(pMF);

    //PostMessage( curDoc(), WM_MOUSEACTIVATE, 0, MAKELPARAM(HTCLIENT,WM_LBUTTONDOWN) );
    acedGetAcadDwgView()->SendMessage(WM_MOUSEACTIVATE, 0, MAKELPARAM(HTCLIENT,WM_LBUTTONDOWN));
}

above is the fuction. I used acedGetAcadDwgView(), but it still does not work.  only when I click the viewport, then the selected entities show.

Technology change world! Coding change technology! We coders are coding!
Distinguished Mentor
owenwengerd
Posts: 594
Registered: ‎08-06-2002
Message 6 of 6 (128 Views)

Re: about modeless dialog used in autocad

09-04-2013 08:43 PM in reply to: 421232206

You need to first set focus to the window, and post the message instead of sending. As I said, I don't know if that will work in your case, but it does work in some cases.

--
Owen Wengerd
ManuSoft

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community