add extra_chars to model setup, model name text edit field

This commit is contained in:
olliw42
2021-07-12 20:07:59 +02:00
committed by Raphael Coeffic
parent bb2ed31e56
commit 621dddf1ee
2 changed files with 7 additions and 6 deletions
+2 -1
View File
@@ -1033,7 +1033,8 @@ void ModelSetupPage::build(FormWindow * window)
// Model name
new StaticText(window, grid.getLabelSlot(), STR_MODELNAME);
auto text = new RadioTextEdit(window, grid.getFieldSlot(), g_model.header.name, sizeof(g_model.header.name));
auto text = new RadioTextEdit(window, grid.getFieldSlot(), g_model.header.name, sizeof(g_model.header.name),
0, "_-.,:;<=>");
text->setChangeHandler([=] {
modelslist.load();
auto model = modelslist.getCurrentModel();
+5 -5
View File
@@ -27,8 +27,8 @@
class ModelTextEdit: public TextEdit
{
public:
ModelTextEdit(Window * parent, const rect_t & rect, char * value, uint8_t length, LcdFlags windowFlags = 0):
TextEdit(parent, rect, value, length, windowFlags)
ModelTextEdit(Window * parent, const rect_t & rect, char * value, uint8_t length, LcdFlags windowFlags = 0, const char * extra_chars = nullptr):
TextEdit(parent, rect, value, length, windowFlags, extra_chars)
{
setChangeHandler([](){
storageDirty(EE_MODEL);
@@ -39,11 +39,11 @@ class ModelTextEdit: public TextEdit
class RadioTextEdit: public TextEdit
{
public:
RadioTextEdit(Window * parent, const rect_t & rect, char * value, uint8_t length, LcdFlags windowFlags = 0):
TextEdit(parent, rect, value, length, windowFlags)
RadioTextEdit(Window * parent, const rect_t & rect, char * value, uint8_t length, LcdFlags windowFlags = 0, const char * extra_chars = nullptr):
TextEdit(parent, rect, value, length, windowFlags, extra_chars)
{
setChangeHandler([](){
storageDirty(EE_GENERAL);
});
}
};
};