Dialog Grid Layout in CAA RADE
Dialogs in CAA RADE can be layed out in "Tabulated Form" or in "Grid Layout Form". The following code illustrates the Grid Layout Form.
.h file
class TSTDialogFromScratch: public CATDlgDialog { DeclareResource(TSTDialogFromScratch, CATDlgDialog); public: TSTDialogFromScratch (); ~TSTDialogFromScratch (); //CATBoolean IsRadButtSelected(CATDlgRadioButton* RadButt); void Build (); CATDlgRadioButton *pRadButt1; CATDlgRadioButton *pRadButt2; CATDlgRadioButton *pRadButt3; CATDlgPushButton *OKButton; };
Notes
- Since my dialog class inherits from CATDlgDialog, I MUST implement a "Build" method. It is defined as Pure Virtual in the inherited class.
.cpp file
TSTDialogFromScratch::TSTDialogFromScratch(): CATDlgDialog((CATApplicationFrame::GetFrame())->GetMainWindow(), "MyDialogFromScratch",CATDlgGridLayout|CATDlgWndNoButton) { //dialog window sizing rules this->SetGridColumnResizable(0,1); this->SetGridColumnResizable(1,1); this->SetGridRowResizable(0,1); this->SetGridRowResizable(1,1); //widget initialization pRadButt1 = NULL; pRadButt2 = NULL; pRadButt3 = NULL; OKButton = NULL; //build it this->Build(); }
NOTES
- The inline call at the constructor declaration does the
following.
- gets the window that will serve as a parent to my dialog box.
- Assigns the text for the window title bar
- specifies the Style of the Dialog Box (in this case, it will have no automatic buttons and will be a grid layout.
- Although it is not specified in the documentation, any
"Style" input in CATIA can be a concatenation of all
allowable inputs to yield the precise look or behavior that you want.
void TSTDialogFromScratch::Build () { OKButton = new CATDlgPushButton(this, "OK",NULL); OKButton->SetGridConstraints(1,1,1,1,CATGRID_RIGHT|CATGRID_BOTTOM); CATDlgFrame * Frame1 = new CATDlgFrame(this,"Shapes", CATDlgGridLayout); Frame1->SetGridConstraints(0,0,1,1,CATGRID_LEFT); //this->Attach4Sides(Frame1); pRadButt1 = new CATDlgRadioButton(Frame1,"Ellipse",NULL); pRadButt1->SetState(CATDlgUncheck,1); pRadButt1->SetGridConstraints(0,0,1,1,CATGRID_LEFT); pRadButt2 = new CATDlgRadioButton(Frame1,"Rectangle",NULL); pRadButt2->SetState(CATDlgUncheck,1); pRadButt2->SetGridConstraints(1,0,1,1,CATGRID_LEFT); pRadButt3 = new CATDlgRadioButton(Frame1,"Triangle",NULL); pRadButt3->SetState(CATDlgUncheck,1); pRadButt3->SetGridConstraints(2,0,1,1,CATGRID_LEFT); this->SetVisibility(CATDlgShow); }
Notes
- As stated earlier Style concatenations are used to accomplish specific behavior or properties. In the first "SetGridConstraints" command the OK button is assigned to stay at the bottom right corner of the dialog box.