We value your input! Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey
2021-08-23 09:04 AM - last edited on 2021-09-14 09:20 AM by Noemi Balogh
2021-08-23 02:24 PM - last edited on 2021-09-08 01:01 PM by Laszlo Nagy
I give you an example of how I do it:
The header of your dialog class:
class ExampleDialog : public DG::ModalDialog,
public DG::PanelObserver,
public DG::ButtonItemObserver,
public DG::CompoundItemObserver
{
public:
ExampleDialog (GSResModule dialResModule);
~ExampleDialog ();
private:
virtual void PanelOpened(const DG::PanelOpenEvent& ev) override;
virtual void ButtonClicked(const DG::ButtonClickEvent& ev) override;
static const short DIALOG_ID = 32530;
enum
{
ButtonID = 1, // Id from your .grc file
};
DG::Button button_;
};
Cpp file :
ExampleDialog ::ExampleDialog (GSResModule dialResModule) :
DG::ModalDialog(dialResModule, DIALOG_ID, dialResModule),
button_(GetReference(), ButtonID),
{
AttachToAllItems(*this);
}
void ExampleDialog ::ButtonClicked(const DG::ButtonClickEvent& ev)
{
...
}
If something is not clear ask questions, I will try to answer.
2021-09-08 09:59 AM
You can't generate a click evet from the code. But if the click handling statements are in a standalone function, you can call that function in the ButtonClicked notification and anywhere else.