OK, After going to online, you see that section are locked. (there is lock image above sections).
You give password at online, locks go to unlock state, project is still build state and you can view program sections.
If you save project now, close project and reopen, sections are locked state and you need to give password again.
On leaving from online you only need to disconnect, close. Program is locked on next online connection.
Same also for offline project, if you open stu/sta file, locks are on. Entering password only opens project view, it won't change build state and on next time you open protection is active.
p.s Tested
Opening password protection of FBD needs build.
Opening password protection of program section don't need build.