Closed kcobley closed 2 years ago
@kcobley Sorry, but that is just a limitation of a program that lacks a full C++ parser. The User Guide documents in Appendix E - Case Statement Generation what and how the builder deals with button callbacks.
This is not something I can fix without a major rewrite so we will have to live with it.
I would suggest you call a function within your button callback that implements your imbedded switch statement. Many would consider that a better style to follow. Paul--
Understood and thanks for the suggestion which should make life more comfortable.
It doesnt quite fit the Appendix E. It looks like what the Builder is doing is detecting the inner case statements of the inner switch as not being required anymore and deleting them. It thinks its deleting redundant button cases.
However, I understand that writing a parser that is robust to all possibilities is tough, and I respect you position not to try :-) It already seems to do an impressive job.
Describe the bug problem occurs when code is generated from Builder after user edits made to button callbacks. If callback edits include a switch statement then the autogenerated code will delete part of the switch statement inside the handler.
To Reproduce Auto generate with button callbacks Edit user code in call back which include a SWITCH statement Re-generate code with Builder Observe deleted user code with hanging SWITCH statement.
Expected behavior I expected user code not to be deleted (Normally Builder does this exceptionally well; so well, I find it impressive :-) )
Example code from my project:
Code before generate:
snip out extra cases to save verbosity
Code after generate: (note no changes were made to the GUI between these two examples
//<Button Enums !Start!> case E_ELEM_BTN1: gslc_SetPageCur(&m_gui, E_PG2); break; case E_ELEM_BTN5: // clicked on the graph so cycle to the next graph data changing the axis labels and axes to suit and pointing to the correct datasets switch (plotDataType)// enums: {extTempHum, extIAQHum, extEffHum, srcTempHum, supTempHum, extHumPres}; { case E_ELEM_NUMINPUT3: // Clicked on edit field, so show popup box and associate with this text field gslc_ElemXKeyPadInputAsk(&m_gui, m_pElemKeyPadNum, E_POP_KEYPAD_NUM, m_pElemVal1_3); break; case E_ELEM_NUMINPUT4: // Clicked on edit field, so show popup box and associate with this text field gslc_ElemXKeyPadInputAsk(&m_gui, m_pElemKeyPadNum, E_POP_KEYPAD_NUM, m_pElemVal1_2_4); break;