I have a class “DateBox” that inherits from another class, which in turn is a BTextControl.
Now, I want to add a BButton to the right of the BTextControl widget. How to do that?
In my naivety, I tried this inside the DateBox ctor:
fStartDate being the DateBox.
So, the label of the BTextControl isn’t found and the TextView is drawn without borders.
Did I explain it clearly enough? I’m a selftaught (well, more like continuously screwing up and sometimes learning…) coder, so I might lack the right vernacular.
Be gentle with me…
It’s a matter of experimentation and testing, thinking about solutions and applying them, whether they work or not, it’s always good to study similar codes to understand the logic.
Until someone knowledgeable comes and say what The Right Way to do it is, a workaround may be to not do it at all. That is, to handle the button independently:
In my very simple test it made the component taller, though.
From the point of view of someone who does not know about this, there’s quite some magic in BTextControl. The text box is a child view, with a smaller frame to account for the border you are missing, which is drawn by the BTextControl, not by the view with the text. You may need to override Draw(), and even more layout stuff.