I have a problem with creating TToolbuttons
at runtime and how they appear in my TToolbar
.
Basically I got a toolbar with some buttons in it already. I can create buttons at runtime and set the parent to the toolbar. But they are always shown as the first buttons in my toolbar.
How can I make them appear at the end of my toolbar? Or any position I want them to be.
Here is a generic procedure that takes a toolbar, and adds a button to it, with a specified caption:
And here is example usage of that procedure:
Your question does also ask how to add a button to an arbitrary place on the TToolbar. This code is similar to before, but it also allows you to specify which index you want the new button to appear after.
And here is example usage for this revised version:
Good luck!
If it works like the Scroll Panel then you can set the .left property to be 1 more than a button to place it to the left of that button. Or set the .left property to be 1 less than the button to place it to the right of that button.
You can use the
left
property of theTToolButton
componentcheck this sample