Power System Platform  2026w10a-beta
Loading...
Searching...
No Matches
ConstantForm Class Reference

Form to edit the constant control data. More...

#include <ConstantForm.h>

Inheritance diagram for ConstantForm:
Collaboration diagram for ConstantForm:

Public Member Functions

 ConstantForm (wxWindow *parent, Constant *constant)
 
virtual bool ValidateData ()
 

Protected Member Functions

virtual void OnCancelButtonClick (wxCommandEvent &event)
 
virtual void OnOKButtonClick (wxCommandEvent &event)
 

Protected Attributes

wxWindow * m_parent = nullptr
 
Constantm_constant = nullptr
 

Detailed Description

Form to edit the constant control data.

Author
Thales Lima Oliveira thale.nosp@m.s@uf.nosp@m.u.br
Date
05/10/2017

Definition at line 31 of file ConstantForm.h.

Constructor & Destructor Documentation

◆ ConstantForm()

ConstantForm::ConstantForm ( wxWindow *  parent,
Constant constant 
)

Definition at line 21 of file ConstantForm.cpp.

21 : ConstantFormBase(parent)
22{
23 SetSize(GetBestSize());
24
25 m_parent = parent;
26 m_constant = constant;
27
28 m_textCtrlValue->SetValue(m_constant->StringFromDouble(m_constant->GetValue()));
29}
static wxString StringFromDouble(double value, int minDecimal=1, int maxDecimals=13)
Convert a double value to string.
Definition Element.cpp:533

◆ ~ConstantForm()

ConstantForm::~ConstantForm ( )
virtual

Definition at line 31 of file ConstantForm.cpp.

31{}

Member Function Documentation

◆ OnCancelButtonClick()

virtual void ConstantForm::OnCancelButtonClick ( wxCommandEvent &  event)
inlineprotectedvirtual

Definition at line 39 of file ConstantForm.h.

39{ EndModal(wxID_CANCEL); }

◆ OnOKButtonClick()

void ConstantForm::OnOKButtonClick ( wxCommandEvent &  event)
protectedvirtual

Definition at line 32 of file ConstantForm.cpp.

33{
34 if(ValidateData()) EndModal(wxID_OK);
35}

◆ ValidateData()

bool ConstantForm::ValidateData ( )
virtual

Definition at line 37 of file ConstantForm.cpp.

38{
39 double value;
40 if(!m_constant->DoubleFromString(this, m_textCtrlValue->GetValue(), value,
41 _("Value entered incorrectly in the field \"Constant value\".")))
42 return false;
43
44 m_constant->SetValue(value);
45 return true;
46}
static bool DoubleFromString(wxWindow *parent, wxString strValue, double &value, wxString errorMsg)
Get a double value from a string. Show a error message if the conversion fail.
Definition Element.cpp:505

Member Data Documentation

◆ m_constant

Constant* ConstantForm::m_constant = nullptr
protected

Definition at line 43 of file ConstantForm.h.

◆ m_parent

wxWindow* ConstantForm::m_parent = nullptr
protected

Definition at line 42 of file ConstantForm.h.


The documentation for this class was generated from the following files: