Skip to content

Commit

Permalink
Added support to select items in list on interface panel by name
Browse files Browse the repository at this point in the history
Added support to enable/disable read-only flag for text box interface controls
Added support to set minimum and maximum values for numeric, track and progress bar interface panel controls
  • Loading branch information
PaulMartinsen committed Mar 10, 2017
1 parent 7636986 commit 03d7f5f
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 0 deletions.
57 changes: 57 additions & 0 deletions utility/InterfacePanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,20 @@ void InterfacePanel::SetListValue(const __FlashStringHelper * ControlName, int n
SetNumber(ControlName, nValue);
}

void InterfacePanel::SetListName(const char * ControlName, const char *ValueName)
{
SendControlHeader(ControlName, F("SelectedName"));
m_rDestination.print(ValueName);
SendDataTail();
}

void InterfacePanel::SetListName(const __FlashStringHelper * ControlName, const __FlashStringHelper *ValueName)
{
SendControlHeader(ControlName, F("SelectedName"));
m_rDestination.print(ValueName);
SendDataTail();
}

void InterfacePanel::SetCheck(const char * ControlName, bool bChecked)
{
SendControlHeader(ControlName, F("Checked"));
Expand Down Expand Up @@ -269,3 +283,46 @@ void InterfacePanel::SetBackColor(const __FlashStringHelper *ControlName, const
m_rDestination.print(Color);
SendDataTail();
}

void InterfacePanel::SetReadOnly(const char *ControlName, bool ReadOnly)
{
SendControlHeader(ControlName, F("ReadOnly"));
m_rDestination.print(ReadOnly ? F("True") : F("False"));
SendDataTail();
}

void InterfacePanel::SetReadOnly(const __FlashStringHelper *ControlName, bool ReadOnly)
{
SendControlHeader(ControlName, F("ReadOnly"));
m_rDestination.print(ReadOnly ? F("True") : F("False"));
SendDataTail();
}

void InterfacePanel::SetMinimum(const char *ControlName, int Value)
{
SendControlHeader(ControlName, F("Minimum"));
m_rDestination.print(Value);
SendDataTail();
}

void InterfacePanel::SetMaximum(const char *ControlName, int Value)
{
SendControlHeader(ControlName, F("Maximum"));
m_rDestination.print(Value);
SendDataTail();
}

void InterfacePanel::SetMinimum(const __FlashStringHelper *ControlName, int Value)
{
SendControlHeader(ControlName, F("Minimum"));
m_rDestination.print(Value);
SendDataTail();
}

void InterfacePanel::SetMaximum(const __FlashStringHelper *ControlName, int Value)
{
SendControlHeader(ControlName, F("Maximum"));
m_rDestination.print(Value);
SendDataTail();
}

11 changes: 11 additions & 0 deletions utility/InterfacePanel.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ class InterfacePanel : public MegunoLinkProtocol
void SetListIndex(const __FlashStringHelper * ControlName, int nIndex);
void SetListValue(const char * ControlName, int nIndex);
void SetListValue(const __FlashStringHelper * ControlName, int nIndex);
void SetListName(const char * ControlName, const char *ValueName);
void SetListName(const __FlashStringHelper * ControlName, const __FlashStringHelper *ValueName);

void SetCheck(const char * ControlName, bool bChecked = true);
void SetCheck(const __FlashStringHelper * ControlName, bool bChecked = true);
Expand Down Expand Up @@ -59,6 +61,15 @@ class InterfacePanel : public MegunoLinkProtocol
void GetValue(const char* ControlName, const char* PropertyName);
void GetValue(const __FlashStringHelper* ControlName, const __FlashStringHelper* PropertyName);

void SetReadOnly(const char *ControlName, bool ReadOnly);
void SetReadOnly(const __FlashStringHelper *ControlName, bool ReadOnly);

void SetMinimum(const char *ControlName, int Value);
void SetMaximum(const char *ControlName, int Value);

void SetMinimum(const __FlashStringHelper *ControlName, int Value);
void SetMaximum(const __FlashStringHelper *ControlName, int Value);

protected:
void SendControlHeader(const char *ControlName, const __FlashStringHelper *PropertyName);
void SendControlHeader(const __FlashStringHelper *ControlName, const __FlashStringHelper *PropertyName);
Expand Down

0 comments on commit 03d7f5f

Please sign in to comment.