Lazarus
Programming => LCL => Topic started by: EganSolo on February 23, 2021, 09:41:00 am
-
I'm in need of a TComboBox with an extra button, much like what you see happen in the Object Inspector when you're editing a color: the drop-down allows you to select a standard color and the button opens up a color dialog window.
I want to mimic that exact behavior in my code. I could, I suppose, create a form, or even a panel, set a combobox and a button on them, rig the thing to act as an editor in a grid, but there would be some wiring that I would need to take care of. I've looked around for an existing widget that does that and couldn't find it (Googled it, really).
Any thoughts would be welcome!
-
You can see how it's done in Object Inspector. Unit and form of Object Inspector are located in Lazarus folder, in /components/ideintf/objectinspector.pp
-
I'm in need of a TComboBox with an extra button, much like what you see happen in the Object Inspector when you're editing a color: the drop-down allows you to select a standard color and the button opens up a color dialog window.
I want to mimic that exact behavior in my code. I could, I suppose, create a form, or even a panel, set a combobox and a button on them, rig the thing to act as an editor in a grid, but there would be some wiring that I would need to take care of. I've looked around for an existing widget that does that and couldn't find it (Googled it, really).
Any thoughts would be welcome!
Now you are being Lazy! :-[
Make a Frame with what you need, from there on you can use it all over.
Set the anchors on the controls so the button will stay with the combobox
They aren't exactly like making a control but its close enough..
-
You can install Eye-Candy Controls. There are TECComboBtn and TECColorCombo which do exactly that.
-
There you go, "Jim Dandy to the rescue" !
-
Thank you guys for your very helpful answer:
dseligo: thanks for pointing out the path to the source of object inspector! You got me curious and I will take a look.
Jamie: Love the idea of the frame as a pseudo-component. I have other things I need to build and that will help.
Blaazen: that's the answer I was hoping to get :)
Much appreciated, everyone.
-
if you are still playing around there is also the TFlowPanel where you can combine the controls you need at design time!