ObjectARX
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to force AutoCad update display, if the modal or modeless dialog is active

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
majklha
462 Views, 5 Replies

How to force AutoCad update display, if the modal or modeless dialog is active

I have modal dialog, what adds entity. This changes show, when the modal dialog hides and Autocad gets focus. 

I want to show this changes, without change focus to Autocad Window. How to do it?

Labels (3)
5 REPLIES 5
Message 2 of 6
tbrammer
in reply to: majklha

It often helps to "simulate" a mouse move like this:

acedGetAcadDwgView()->PostMessage(WM_MOUSEMOVE, 0L, 0L);

Thomas Brammer ● Software Developer ● imos AGLinkedIn
If an answer solves your problem please [ACCEPT SOLUTION]. Otherwise explain why not.

Message 3 of 6
majklha
in reply to: tbrammer

Thanks, but it doesnot work: 

I try only:

acedGetAcadDwgView()->PostMessage(WM_MOUSEMOVE, 0L, 0L);

and also (part of method of my own modal window):

//----
ShowWindow(SW_HIDE);
EnableWindow(FALSE);
CWnd::FromHandle(adsw_acadMainWnd())->EnableWindow(TRUE);
CWnd::FromHandle(adsw_acadMainWnd())->ShowWindow(SW_SHOW);
CWnd::FromHandle(adsw_acadMainWnd())->SetFocus();
//-----
acedGetAcadDwgView()->PostMessage(WM_MOUSEMOVE, 0L, 0L);
acedUpdateDisplay();
CWnd::FromHandle(adsw_acadMainWnd())->RedrawWindow();
//----
acedRedraw(NULL, 1);
CWnd::FromHandle(adsw_acadMainWnd())->RedrawWindow();
CWnd::FromHandle(adsw_acadMainWnd())->EnableWindow(FALSE);
ShowWindow(SW_SHOW);
EnableWindow(TRUE);

 and nothing....

Message 4 of 6
tbrammer
in reply to: majklha

I don't think that you need to give the focus to AutoCAD to update the graphic system. You will need the focus if you need any user input in the AutoCAD editor.


How does your modeless dialog interact with AutoCAD? Do you call ARX API functions directry from message handlers? It is safer to define a command and call it by 

acDocManager->sendStringToExecute(acDocManager->curDocument(), _T("MyCommand"),false, true);

See <ARXSDK>\samples\editor\mfcsamps\modeless.

If you don't make changes in a normal command context you must make sure to lock your document. The easiest way is to use an AcAxDocLock simply by adding the line:

AcAxDocLock lock;

 You can try this to force an update of the graphic system:

if (actrTransactionManager->numActiveTransactions() <= 0)
{
   actrTransactionManager->queueForGraphicsFlush();
   actrTransactionManager->flushGraphics();
}
acedUpdateDisplay(); 

 

or try these:

 

acedRedraw(NULL,1);
acedCommandS(RTSTR, _T("_REGEN"), RTNONE); 

int acdbQueueForRegen(const AcDbObjectId *pIdArray, int nNumIds);
void ads_regen(); // Undocumented feature. No header available. Use at own Risk. 
ads_regen();

 


Thomas Brammer ● Software Developer ● imos AGLinkedIn
If an answer solves your problem please [ACCEPT SOLUTION]. Otherwise explain why not.

Message 5 of 6
majklha
in reply to: tbrammer

I asked for modeless or modal dialog. I tested it on modal dialog. 

I call standard command:

 

 

 

acedRegCmds->addCommand(_T("MAJCUT"), _T("MC"), _T("MC"), ACRX_CMD_MODAL, ZobrazMainCutDialog);

 

 

 

My idea is to work with modeless dialog only if user have more monitors (displays)...

It seems to be more difficult problem, that I have imagined :-).

And yes, I call API functions from my dialog message handlers. Eg. for adding entity, etc...

Message 6 of 6
majklha
in reply to: tbrammer

ads_regen() works from modal dialog.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Customer Advisory Groups


Autodesk Design & Make Report