TAdvOfficeToolSelector bug + question

I want to create a custom TAdvOfficeToolSelector. That means, disabling its provided popup and creating my own. I've already created my own popup, works fine with a button or TSpeedButton.

How do I add my own Popup.Show(); to the TAdvOfficeToolSelector?

I've tried adding it to OnDropDown and OnDropDown close event but its own popup messes up display of my own.

Later, I discovered AdvOfficeToolSelector1.BlockDropDown(true). Is that the solution and then using OnDropDown event?

Great, except that one crashes.
Access violation at address 008C457C in module 'Project1.exe'. Write of address 000003F5.

How to reproduce the above bug?

  1. drop on a blank form TAdvOfficeToolSelector
  2. drop a button
  3. add code to the button:


  1. immediately after clicking the button it crashes.

TAdvOfficeToolSelector is designed to allow selecting an item from the tools collection. It was not designed to somehow override / block / interfere with this default behavior.
If you want to show a popup when clicking a button, a possible solution is to do this directly from a button, for example a TAdvGlowButton which you can configure to use the same colors as TAdvOfficeToolSelector.

Thanks, I tried TAdvGlowButton but if I use OnDropDown event (to display my popup form), it also triggers OnClick event. That doesn't seem right. OnClick should be triggered when the button part of the button is clicked and OnDropDown when dropdown part of the button is clicked. By contrast, if only the button is clicked the OnDropDown is not triggered.

Is this by design? If so, can I make it only trigger the specific event based on which part of the button is clicked and not both of them?

The question is still not answered and answer is still expected...

I’m out of office and this will be on my todolist when I’m back in the office.

It is by design.
You could set a flag in the OnDropDown if you want to ignore from there the subsequent OnClick event.

This topic was automatically closed 60 minutes after the last reply. New replies are no longer allowed.