Text Display Object has 'handles' as if in graphics mode

I have a form in which clicking on successive buttons displays a further row of options, as in:

Screen Shot 2021-12-21 at 10.29.26 am

The orange-coloured tabs indicate the path to the fourth row of tabs. But each of the tabs in that fourth row, when clicked, has handles, as they would appear in graphics mode. Clicking on one of those tabs invokes this sort of code (the zoomwindow parameters are previously assigned):

        elseif Button[2,-1] = "JointStats"
            opendatabase "JointStats"
            opensheet
            zoomwindow Top, Left, Height, Width, "nopalette noscroll"

How or why would this happen?

Removing the opensheet and zoomwindow statements makes no difference. And the JointStats database has no procedures or forms.

Further research - the handles appear no matter what file is opened - even a new and totally empty database.

And openfile gives the same result as opendatabase.

Obviously there is additional code above this that sets up the Button variable. Probably this code uses either the object or selectobjects statement both of which select an object. You should use the selectnoobjects statement to unselect them. Or better yet, don’t use object or selectobjects, they aren’t necessary unless you are actually going to modify the object. Use objectinfo( with info(“clickedobjectid”) instead, these have no side effect of selecting the object.

Yes, that fixed it but I’m puzzled because the same block of code runs when any tab is clicked. This is the code:

if val(Button[1,1]) > 0 and val(Button[1,1]) ≤ 9
    ;  Delete all higher-level tabs bars and reset tab colours in this bar
    selectobjects objectinfo("name")[1,1] > Button[1,1] and objectinfo("name")[1,1] < "9"
    deleteselectedobjects
    selectobjects objectinfo("name")[1,1] = Button[1,1]
    changeobjects "$TextBackgroundFill","FFD600"
    selectobjects objectinfo("name") = Button
    changeobjects "$TextBackgroundFill","FFA500"
    ;  Extract y dimension of top of existing tabs bar and define value for new bar
    object Button
    lvLocationY = str(val(rtop(objectinfo("rectangle"))) + lvVertTabSep)
endif

Adding a selectnoobjects statement at the end (within the if block) solves the problem. But why does the problem not occur with other tab clicks?

And you can see that objects are indeed modified.

Maybe I should point out that the tab bars are ephemeral - each is created on the fly as a higher-level tab is clicked.

The handle is created whenever the selectobjects or object statement is used. However, when in data mode Panorama doesn’t immediately display the handles. Some additional window display operation is needed to make the handles visible. If you use selectnoobjects before that happens, the handles will never actually be visible.