Developer forum
cancel
Showing results for 
Search instead for 
Did you mean: 

How To Fire Click Event from Push Button in Dialog

icon
Newcomer
Please teach me.
How To Fire Click Event from Push Button in Dialog on C++ Code.
DG_Command ?
2 REPLIES 2

Konstantin
Newcomer

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.

VEGH
Graphisoft
Graphisoft

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.

Still looking?

Browse more topics

Back to forum

See latest solutions

Accepted solutions

Start a new discussion!