Hints and TIDEPaletteToolbar

Hello


other great improvement that would be very useful is the way the TIDEPaletteToolbar works with ButtonHints.

I would like to control the button hint at runtime about a context but hint is set at button creation and UpdatePanel neither UpdatePalette are virtual marked. I think a could solve it using complex behaviour but i think an event would be really elegant.

property OnGetComponentHint : TOnGetComponentHint read... write....

and replace at function TIDEPaletteToolbar.CreateButton(AClass: TComponentClass): TPaletteButton;
...
if AClass <> nil then
    begin
      Hint := FButtonHints.Values[AClass.ClassName];
      if Hint = '' then
        Hint := AClass.ClassName;
    end;

by something like this:

..
if AClass <> nil then
begin
Hint := AClass.ClassName;
if assiged(fOnGetComponentHint) 
fOnGetComponentHint(self, AClass, Hint);
end
..

Note that passing TComponentClass so event could use it calling a function class or create the instance of the Component asociated to the button and ask to instance or some implemented interface about the correct hint.

All the best
ilde



If setting the hint at button creation time is enough for you, why don't you just use ButtonHints property to make a mapping between the class name and desired hint? You can just update the ButtonHints property before each UpdatePalette call.


UdatePalette is not marked as virtual so I dont have way to override method and I tested that is called only at tab change but not at first paint. I dont want to modify your code because I want to have future compatibility for continue suscription.

All the best
ilde

We will make UpdatePalette virtual.