Setactivedatabase affects Text Editor Objects with Pop Up Editing enabled

Database A contains multiple Text Display Objects with Pop Up Editing enabled.
If I run the following procedure:

setactivedatabase "Database B"
field X

…database A suddenly and incorrectly displays the contents of Database B in those TEOs, or displays “Field doesn’t exist”, if indeed the field name doesn’t exist in Database B.

Just making Database B active doesn’t trigger this display error. There must be some kind of movement in Database B, like using the field statement.

Note: I’m no longer using TEOs with pop up editing enabled, and I only came across this when I started converting another Pan6 DB which uses Cells (TEO’s with Pop-up editing).

Your subject line says “Text Display Objects” but I think you mean “Text Editing Objects”, right?

Ok, that’s a weird bug. What’s happening is that setactivedatabase makes a “secret” window active. Then the field statement redisplays all of the cells because it thinks it needs to change which cell is highlighted (this highlighting doesn’t appear if the pop-up option is off). But the wrong database is active, so the cells get messed up.

I found a simple workaround:

setactivedatabase "Database B"
noshow
field X

Or another workaround is

setactivedatabase "Database B"
noshow
field X
.. do something with field X
setactivedatabase ""
field A // some field in the original database

I’ve made an entry for this bug in the bug list, but this probably won’t be fixed for a long time if ever. I did take a look to see if there was an easy quick fix, but unfortunately not.

You are right! I edited the subject line.