The behavior has changed in TD 7.0.2.
(7.0.1 reacts like expected)
Normally, a label is linked to an object by the outline position in the code.
So when a label is in front of an object in the outline, the Sal functions will take that label and object.
That was the case for any object in TD for ages.
But now in 7.0.2, it seems that it now uses the visual position of the label and the outline position is not taken into account at all.
I tested several object types (pushbuttons, tables, datafields etc) and I see this defect only on picture objects.
Use testcase. There are 3 rows of objects having labels.
The toggle button will hide/show label3 and the object, which is a picture object
Initially it works. Both label and picture are toggled.
Now move the picture object in the outline code up or down.
See that the outline position has no effect. Label3 keeps being toggled in all cases. Even when another label is in front of the picture object.
Now move the label3 visually to be at the right side of the picture.
See that the label is then not toggled.
Move the label3 to be on top of the picture and it is toggled again.
Seems that the link between label and picture is now only when the label is at the left and top side of the picture.
Nice testcase is to swap visually label2 and label3 and see that now label2 is toggled.
This is clearly changed behavior which breaks existing code.
Pictures and labels are mostly used to label images or legends. The text can be in front/top/right or bottom or even anywhere on screen. Now the label MUST be visually at the left or top side to work.
All objects need to react the same as always: the outline position determines how a label and object is linked and not the visual position on screen.
This has been registered buy OpenText as:
Ticket # 3061813: SalHide/ShowWindowAndLabel reacts different on pictures