When you launch the Mathcad worksheet the PushBtn_Click() subroutine is not executed. So the variable state is dimensioned, but since nothing is done to assign it any value it just has the default value of 0. Since no text is assigned to the push button, the text is whatever was there the last time you saved the Mathcad worksheet (it's stored internally). The first time you click on a button state is not equal to -1, so the else cause is executed, which sets the state to -1 and the text to "-". If the text was already set to "-" when the worksheet was loaded the button may appear to have not executed, but it did, and the corresponding value in q changes to -1. To fix this behaior, immediately after the statement Dim state add two more lines:
state = 1
PushBtn.Text = " + "
These are in the body of the script, outside of any subroutines. They will be executed when the worksheet is loaded, but only then. In the above example the state will be set to 1, and the text to " + ".
Richard