I have a button/label with text and programmatically I want to be able to change the text in the button. However it seems you can’t do that IF the button also has a ‘tooltip’ attached to it. The text property just disappears as a property in the method editor once you assign a tooltip (and leave Developer mode). If you leave it in (elements.myButton.text) it just returns ‘undefined’. Does anyone know if that is meant to be or is that a bug? It would seem a bug to me that the text property would disappear just because there was a tooltip attached to button. A button will often be fairly small, limiting the amount of text you want to put in it and thus making it important that you can also add a tooltip to it for greater explanation.
This ‘feels’ like a bug…
Now not sure or not whether it is a bug. I have worked out that it only messes up when the ‘displaysTags’ is checked (i.e. to merge data with the label). Going back in time I seem to remember that one HAD to check that box to have any tooltip display but in any case that certainly isn’t the case now. However, I’m still not sure why one couldn’t get the text programmatically even with it containing ‘merged’ data. But it isn’t a big deal for me as my tooltip in this case doesn’t actually need any merged data and where I’m using merged data I don’t need to figure out the text
hmm, when it is related to checking ‘displaysTags’ I would say that it makes sense…
I have confirmed your experiments.
If the tooltip text is defined in the developer and then you go and make a new method for the form, the “text” attribute of the button or label is not present. If you leave the tooltip blank and the text blank and only define them in the method then that seems to work fine. It does seem odd behaviour though. Maybe report a defect and let the experts examine their internal code for a “gotcha”.
Hi Tom,
No actually it was my bad. Everything seems to work fine if you just define the tooltip. The problem stems from clicking the ‘displaysTags’ checkbox. I think over the years with my having to do Servoy codus interruptus I’ve just got lazy and always checked displaysTags whenever doing a tooltip. And to be honest I’d have to think long and hard about when I’d really like to be able to both programmatically access the ‘text’ property of a label/button AND use displaysTags on the same item. Not saying I couldn’t come up with a scenario but nothing comes to mind!