Why are variable values not displayed or updated in the BASIC IDE watch window?

I have the following code in my macro:

REM ***** BASIC *****

Sub Main

Dim Xfac as Integer
Dim x as Integer
Dim i as Integer
X=1
Xfac=5
For i=1 to Xfac
	x=x*i
Next i
Msgbox "Factorial " + Xfac + " = " + X

End Sub

I can add the variables to the watch window, but no value or type is displayed when the macro is run. Nor can I click on a variable in the watch window to change it’s value.

Is this a BUG or am I doing something incorrectly?

LO v5.1.2 on Windows 7.

Thanks for the help.

Set a breakpoint in your code (a place to stop & examine) such your x=1 line. Do this by placing cursor on that line & hit F9 key. Start the macro execution. It will stop at that line. Now you can proceed line by line using the F8 key and you will see your results. Step out of the routine with Ctl-Shift-F8 or step into a routine with Shift-F8. You can also use defined buttons on the toolbar instead of the keyboard.

Thank you Ratslinger, That worked. It’s odd though…I googled to try and find an answer and none of the things I found mentioned that breakpoints are required to use the watch window.

If you think about it, since your variables are private (visible only in the Sub) once it executes there is nothing to look at. Additionally, if you want to change a value the system needs a pause to allow this to be done.