MFC forms and selecting points

MFC forms and selecting points

Anonymous
Not applicable
654 Views
14 Replies
Message 1 of 15

MFC forms and selecting points

Anonymous
Not applicable
I have a button on a MFC form that allows a user to pick a point. When the button is clicked Autocad minimizes and locks up. The prompt asking the user to select a point is displayed. The code I am using is below. Is there a different way to do this? void CTestDlg::OnBnClickedStartpoint() { int rc; AcGePoint3d startpt,p; startpt.x=0; startpt.z=0; startpt.y=0; ShowWindow(0); rc = acedGetPoint(startpt,pMessage, p); if (rc == RTNONE) { rc = RTNORM; ShowWindow(1); return; } ShowWindow(1); }
0 Likes
655 Views
14 Replies
Replies (14)
Message 2 of 15

Anonymous
Not applicable
Try using these functions BeginEditorCommand(); CompleteEditorCommand(); CancelEditorCommand(); "Rob Thyen" wrote in message news:40213a45$1_3@newsprd01... > I have a button on a MFC form that allows a user to pick a point. When the > button is clicked Autocad minimizes and locks up. The prompt asking the > user to select a point is displayed. The code I am using is below. Is there > a different way to do this? > > void CTestDlg::OnBnClickedStartpoint() > { > int rc; > AcGePoint3d startpt,p; > > startpt.x=0; > startpt.z=0; > startpt.y=0; > > ShowWindow(0); > > rc = acedGetPoint(startpt,pMessage, p); > > if (rc == RTNONE) > { > rc = RTNORM; > ShowWindow(1); > return; > } > > ShowWindow(1); > } > >
0 Likes
Message 3 of 15

Anonymous
Not applicable
Instead of 'ShowWindow(0);' call: BeginEditorCommand(); and instead of 'ShowWindow(1);' call: CompleteEditorCommand(); Hope it works for you! "Rob Thyen" wrote in message news:40213a45$1_3@newsprd01... > I have a button on a MFC form that allows a user to pick a point. When the > button is clicked Autocad minimizes and locks up. The prompt asking the > user to select a point is displayed. The code I am using is below. Is there > a different way to do this? > > void CTestDlg::OnBnClickedStartpoint() > { > int rc; > AcGePoint3d startpt,p; > > startpt.x=0; > startpt.z=0; > startpt.y=0; > > ShowWindow(0); > > rc = acedGetPoint(startpt,pMessage, p); > > if (rc == RTNONE) > { > rc = RTNORM; > ShowWindow(1); > return; > } > > ShowWindow(1); > } > >
0 Likes
Message 4 of 15

Anonymous
Not applicable
In order to use the BeginEditorCommand and others as specified, you have to change your dialog to derive off of CAcUiDialog instead of CDialog
0 Likes
Message 5 of 15

Anonymous
Not applicable
can somebody give an example of how to change over to a CAcUiDialog lass -- what all will I need to change?? "Randy Sanders" wrote in message news:40215b87$1_1@newsprd01... > In order to use the BeginEditorCommand and others as specified, you have to > change your dialog to derive off of CAcUiDialog instead of CDialog > >
0 Likes
Message 6 of 15

Anonymous
Not applicable
Rob Thyen wrote: > can somebody give an example of how to change over to a CAcUiDialog > lass -- what all will I need to change?? > If you'd rather not derive from CAcUiDialog (personally I see no compelling reason to do so) you can use the following from your dialog GetParent()->EnableWindow(TRUE); ShowWindow(SW_HIDE); // do your thing on screen ShowWindow(SW_SHOW); GetParent()->EnableWindow(FALSE); EnableWindow(TRUE); -- Best regards, Byron Blattel CADwerx--Applications for AutoCAD Autodesk Registered Developer Contact Info @ http://www.cadwerx.net Custom Programming Services - ObjectARX/C++/MFC/ASP/STL/ATL/ISAPI...
0 Likes
Message 7 of 15

Anonymous
Not applicable
Thanks Byron, that worked as usual...Is there anything you dont know about this stuff??? Thanks again, Rob "Byron Blattel" wrote in message news:4021684e$1_3@newsprd01... > Rob Thyen wrote: > > > can somebody give an example of how to change over to a CAcUiDialog > > lass -- what all will I need to change?? > > > > If you'd rather not derive from CAcUiDialog (personally I see no > compelling reason to do so) you can use the following from your dialog > > GetParent()->EnableWindow(TRUE); > ShowWindow(SW_HIDE); > // do your thing on screen > ShowWindow(SW_SHOW); > GetParent()->EnableWindow(FALSE); > EnableWindow(TRUE); > > -- > Best regards, > > Byron Blattel > CADwerx--Applications for AutoCAD > Autodesk Registered Developer > Contact Info @ http://www.cadwerx.net > Custom Programming Services - ObjectARX/C++/MFC/ASP/STL/ATL/ISAPI...
0 Likes
Message 8 of 15

Anonymous
Not applicable
Rob Thyen wrote: > Thanks Byron, that worked as usual...Is there anything you dont know about > this stuff??? > > Thanks again, > > Rob Absolutely, but I'm working on the list ;) -- Best regards, Byron Blattel CADwerx--Applications for AutoCAD Autodesk Registered Developer Contact Info @ http://www.cadwerx.net Custom Programming Services - ObjectARX/C++/MFC/ASP/STL/ATL/ISAPI...
0 Likes
Message 9 of 15

Anonymous
Not applicable
If you ever want to change from CDialog to CAcUiDialog dialog class do the following: #include "acuiDialog.h" and change all instances from CDialog to CAcUiDialog in the .h and .cpp file, the thing I like the most about doing this is the created dialog box has the AutoCAD icon on the top left making the dialog box look like an actual AutoCAD dialog box. "Rob Thyen" wrote in message news:40216717_1@newsprd01... > can somebody give an example of how to change over to a CAcUiDialog > lass -- what all will I need to change?? > > > "Randy Sanders" wrote in message > news:40215b87$1_1@newsprd01... > > In order to use the BeginEditorCommand and others as specified, you have > to > > change your dialog to derive off of CAcUiDialog instead of CDialog > > > > > >
0 Likes
Message 10 of 15

Anonymous
Not applicable
"Gary D. Glass" wrote in message news:402181e4$1_1@newsprd01... > the thing I like the most about doing this is the > created dialog box has the AutoCAD icon on the top left > making the dialog box look like an actual AutoCAD dialog box. Of course, you can do that with just about any ole CDialog: CWnd::SetIcon(GetClassLong(adsw_AcadMainWnd(), GCL_HICON), true); -- Copyright (c)2004 Tony Tanzillo Unauthorized reproduction expressly prohibited. AcadXTabs: MDI Document Tabs for AutoCAD http://www.acadxtabs.com > > > "Rob Thyen" wrote in message > news:40216717_1@newsprd01... > > can somebody give an example of how to change over to a CAcUiDialog > > lass -- what all will I need to change?? > > > > > > "Randy Sanders" wrote in message > > news:40215b87$1_1@newsprd01... > > > In order to use the BeginEditorCommand and others as specified, you have > > to > > > change your dialog to derive off of CAcUiDialog instead of CDialog > > > > > > > > > > > >
0 Likes
Message 11 of 15

Anonymous
Not applicable
Thanks for the info I didn't know that. "Tony Tanzillo" wrote in message news:402194e4$1_3@newsprd01... > "Gary D. Glass" wrote in message news:402181e4$1_1@newsprd01... > > > the thing I like the most about doing this is the > > created dialog box has the AutoCAD icon on the top left > > making the dialog box look like an actual AutoCAD dialog box. > > Of course, you can do that with just about any ole CDialog: > > CWnd::SetIcon(GetClassLong(adsw_AcadMainWnd(), GCL_HICON), true); > > > > -- > Copyright (c)2004 Tony Tanzillo > Unauthorized reproduction expressly prohibited. > > AcadXTabs: MDI Document Tabs for AutoCAD > http://www.acadxtabs.com > > > > > > > "Rob Thyen" wrote in message > > news:40216717_1@newsprd01... > > > can somebody give an example of how to change over to a CAcUiDialog > > > lass -- what all will I need to change?? > > > > > > > > > "Randy Sanders" wrote in message > > > news:40215b87$1_1@newsprd01... > > > > In order to use the BeginEditorCommand and others as specified, you have > > > to > > > > change your dialog to derive off of CAcUiDialog instead of CDialog > > > > > > > > > > > > > > > > > > > >
0 Likes
Message 12 of 15

Anonymous
Not applicable
In your Dialog .h file replace class MyDialog : public CDialog { blahblahblah } with class MyDialog : public CAcUiDialog { blahblahblah } Priit Peipman
0 Likes
Message 13 of 15

Anonymous
Not applicable
Forgot something.... in cpp file constructor function should be: MyDialog::MyDialog(CWnd* pParent /*=NULL*/) : CAcUiDialog(MyDialog::IDD, pParent) Priit Peipman "Priit Peipman" wrote in message news:40221ba3$1_3@newsprd01... > In your Dialog .h file replace > > class MyDialog : public CDialog > { > blahblahblah > } > > with > > class MyDialog : public CAcUiDialog > > { > blahblahblah > } > > Priit Peipman > >
0 Likes
Message 14 of 15

Anonymous
Not applicable
If you didn't figure it out here is a simple Dialog class in this zip file,
I add the Acad Dlg includes in the stdafx.h file

// AutoCAD MFC Extensions:

#include "adui.h"

#include "acuiComboBox.h"

#include "acuiDialog.h"


"Priit Peipman" <priit@ehitus.ee> wrote in message
news:40221c19_2@newsprd01...
> Forgot something.... in cpp file constructor function should be:
>
> MyDialog::MyDialog(CWnd* pParent /*=NULL*/) : CAcUiDialog(MyDialog::IDD,
> pParent)
>
> Priit Peipman
>
> "Priit Peipman" <priit@ehitus.ee> wrote in message
> news:40221ba3$1_3@newsprd01...
> > In your Dialog .h file replace
> >
> > class MyDialog : public CDialog
> > {
> > blahblahblah
> > }
> >
> > with
> >
> > class MyDialog : public CAcUiDialog
> >
> > {
> > blahblahblah
> > }
> >
> > Priit Peipman
> >
> >
>
>



Attachment not added (too large): "TestDlg.zip"
0 Likes
Message 15 of 15

Anonymous
Not applicable
There are actually several subtle things I like about using CAcUiDialog. For instance, dialog persistency (size, position, column widths, etc) and resizing is much simpler than equivalent CDialog implementations. Tom Stoeckel "Gary D. Glass" wrote in message news:402181e4$1_1@newsprd01... > If you ever want to change from CDialog to CAcUiDialog dialog class do the > following: > > #include "acuiDialog.h" and change all instances from CDialog to CAcUiDialog > in the .h and .cpp file, the thing I like the most about doing this is the > created dialog box has the AutoCAD icon on the top left making the dialog > box look like an actual AutoCAD dialog box. > > > "Rob Thyen" wrote in message > news:40216717_1@newsprd01... > > can somebody give an example of how to change over to a CAcUiDialog > > lass -- what all will I need to change?? > > > > > > "Randy Sanders" wrote in message > > news:40215b87$1_1@newsprd01... > > > In order to use the BeginEditorCommand and others as specified, you have > > to > > > change your dialog to derive off of CAcUiDialog instead of CDialog > > > > > > > > > > > >
0 Likes