We value your input! Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey
2020-07-08 10:52 AM - last edited on 2021-09-15 11:58 AM by Noemi Balogh
... static short DGCALLBACK place_Euroform_Handler (short message, short dialogID, short item, DGUserData userData, DGMessageData msgData) { return 0; } // Callback function for DG ... GSErrCode __ACENV_CALL CommandHandler (const API_MenuParams *menuParams) { GSErrCode err = NoError; bool isOK; DGUserData userData; isOK = DGModalDialog (ACAPI_GetOwnResModule (), 32510, ACAPI_GetOwnResModule (), place_Euroform_Handler, userData == DG_OK); return err; } ...Following is .grc file.
... #include "DGDefs.h" #include "DGWinDefs.h" /* ------------------------------------------------------------ place Euroform */ 'GDLG' 32510 Modal 40 40 300 400 "" { /* [ 1] */ Button 170 350 70 20 LargePlain "OK" /* [ 2] */ Button 100 350 70 20 LargePlain "Cancel" /* [ 3] */ CenterText 8 4 250 12 SmallPlain "Sample text" } 'DLGH' 32510 DLG_32510 { 1 "OK Button" Button_0 2 "Cancel Button" Button_1 3 "Text" CenterText_0 }
Solved! Go to Solution.
2020-07-08 05:08 PM
'GDLG' 32500 Modal 40 40 300 130 "Hello World Example Dialog" { /* [ 1] */ Button 145 102 150 21 LargePlain "Close" /* [ 2] */ LeftText 145 55 150 40 LargePlain "Hello World" /* [ 3] */ Icon 5 5 120 120 32500 } 'DLGH' 32500 DLG_32500 { 1 "Close Button" Button_0 2 "Hello World Text" LeftText_0 3 "Earth Icon" IconItem_0 }Then you should create a C++ class for your dialog inherited from the DG::ModalDialog class.
#include "DGModule.hpp" class HelloWorldDialog : public DG::ModalDialog, public DG::ButtonItemObserver, public DG::CompoundItemObserver { protected: enum Controls { ButtonID = 1, LeftTextID = 2, IconItemID = 3 }; DG::Button closeButton; DG::LeftText helloWorldText; DG::IconItem earthIcon; virtual void ButtonClicked (const DG::ButtonClickEvent& ev) override; public: HelloWorldDialog (); ~HelloWorldDialog (); }; HelloWorldDialog::HelloWorldDialog () : DG::ModalDialog (ACAPI_GetOwnResModule (), 32500, ACAPI_GetOwnResModule ()), closeButton (GetReference (), ButtonID), helloWorldText (GetReference (), LeftTextID), earthIcon (GetReference (), IconItemID) { AttachToAllItems (*this); } HelloWorldDialog::~HelloWorldDialog () { } void HelloWorldDialog::ButtonClicked (const DG::ButtonClickEvent& ev) { if (ev.GetSource () == &closeButton) PostCloseRequest (Accept); }And finally you can show your dialog by creating an instance from your class and calling its Invoke method:
static void ShowDialog () { HelloWorldDialog dialog; dialog.Invoke (); }
2020-07-08 05:08 PM
'GDLG' 32500 Modal 40 40 300 130 "Hello World Example Dialog" { /* [ 1] */ Button 145 102 150 21 LargePlain "Close" /* [ 2] */ LeftText 145 55 150 40 LargePlain "Hello World" /* [ 3] */ Icon 5 5 120 120 32500 } 'DLGH' 32500 DLG_32500 { 1 "Close Button" Button_0 2 "Hello World Text" LeftText_0 3 "Earth Icon" IconItem_0 }Then you should create a C++ class for your dialog inherited from the DG::ModalDialog class.
#include "DGModule.hpp" class HelloWorldDialog : public DG::ModalDialog, public DG::ButtonItemObserver, public DG::CompoundItemObserver { protected: enum Controls { ButtonID = 1, LeftTextID = 2, IconItemID = 3 }; DG::Button closeButton; DG::LeftText helloWorldText; DG::IconItem earthIcon; virtual void ButtonClicked (const DG::ButtonClickEvent& ev) override; public: HelloWorldDialog (); ~HelloWorldDialog (); }; HelloWorldDialog::HelloWorldDialog () : DG::ModalDialog (ACAPI_GetOwnResModule (), 32500, ACAPI_GetOwnResModule ()), closeButton (GetReference (), ButtonID), helloWorldText (GetReference (), LeftTextID), earthIcon (GetReference (), IconItemID) { AttachToAllItems (*this); } HelloWorldDialog::~HelloWorldDialog () { } void HelloWorldDialog::ButtonClicked (const DG::ButtonClickEvent& ev) { if (ev.GetSource () == &closeButton) PostCloseRequest (Accept); }And finally you can show your dialog by creating an instance from your class and calling its Invoke method:
static void ShowDialog () { HelloWorldDialog dialog; dialog.Invoke (); }
2020-07-09 02:14 AM