Archicad C++ API
About Archicad add-on development using the C++ API.

How to use DG::ModalDialog without GRC and add items to it

Anonymous
Not applicable
We have

static void Do_Dialog (void)
{
DG::ModalDialog dlg(DG::Rect(200,200,700,800));
dlg.SetTitle("The Title");
dlg.Invoke();
} // Do_Dialog

dlg created without using any GRC resource.
Please anyone explains me and provides correct API to add to dlg for example button or any other control
2 REPLIES 2
Ralph Wessel
Mentor
nixonjan wrote:
We have dlg created without using any GRC resource.
Please anyone explains me and provides correct API to add to dlg for example button or any other control
Is there a good reason for not simply using a GRC? It's very straight-forward, and items in the GRC can be shown, hidden, moved etc as required.
Ralph Wessel BArch
Software Engineer Speckle Systems
Anonymous
Not applicable
Today I've made a palette without using GRC. I think you may add items to ModalDialog the same way:

class palD: public DG::Palette
{
public:
	palD( );
	virtual	~palD();

private:
	// Buttons
	DG::IconButton* btCreate;
	DG::IconButton* btSwitch;
};

// Constructor :
palD::palD( )
: DG::Palette( DG::Rect(DG::Point(0,0),193,28), paletteGUID, NoGrow, Close, LeftCaption, NormalFrame )
{
	ACAPI_RegisterModelessWindow( GetId(), PaletteAPIControlCallBack,
		API_PalEnabled_FloorPlan +
		API_PalEnabled_Section +
		API_PalEnabled_Detail +
		API_PalEnabled_Layout +
		API_PalEnabled_3D );

	// Add buttons :
	btCreate = new DG::IconButton( *this, DG::Rect( DG::Point(1,1),30,26) );
	btCreate->SetIcon( DG::Icon( 32100 ) );
	btCreate->Attach( *this );

	btSwitch = new DG::IconButton( *this, DG::Rect( DG::Point(65,1),30,26) );
	btSwitch->SetIcon( DG::Icon( 32102 ) );
	btSwitch->Attach( *this );

	btCreate->Show();
	btSwitch->Show();
}

palD::~palD()
{
	btCreate->Detach( *this );
	btSwitch->Detach( *this );
	delete btCreate;
	delete btSwitch;

	ACAPI_UnregisterModelessWindow( GetId() );
}
I hope this helps...