Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 4 of 4 total
Thread Help With HOT Interface States
Tue, Jun 14 2016 6:58 AMPermanent Link

Mark Brooks

Slikware

Avatar

Hi All,

Anyone help me with this one:

I have created one of my "usual" TBasicPanelControl descendants which I'm using to build a custom list. This time I wanted to add a bit of flair when the user mouses over the panel. I had though I could simply add a new interface state called "Hot" with a slightly different visual appearance to "Normal" and that everything else would then be handled by the inheritance from TBasicPanelControl. It is not.

On closer inspection, I see that the UpdateInterfaceState virtual method of TBasicPanelControl has been overridden in the library source with the comment:

  { Suppress any interface state changes due to mouse overs, etc. }

If I remove this override, then my "Hot" interface state comes alive.

So, I guess my questions are:

- Why has this functionality been suppressed in the base class?
- How can I re-introduce it without changing Tim's source?
- Have I inherited from the wrong parent?

Many thanks
Mark
Tue, Jun 14 2016 8:05 AMPermanent Link

Matthew Jones

Mark Brooks wrote:

> On closer inspection, I see that the UpdateInterfaceState virtual
> method of TBasicPanelControl has been overridden in the library
> source with the comment:
>
>    { Suppress any interface state changes due to mouse overs, etc. }
>
> If I remove this override, then my "Hot" interface state comes alive.

Just been doing this myself, trying to make a basic "tabs" control from
the toolbar. I dug into the source, and ended up with this:

procedure TIndexBarButton.UpdateInterfaceState;
begin
   if Enabled and (not (Pushed or Focused or Over)) then
   begin
       if FActive then
           InterfaceState:=ACTIVE_STATE_NAME
       else
           inherited UpdateInterfaceState;
   end
   else               
   begin
       inherited UpdateInterfaceState;
   end;
end;

This is basically saying "if the component Active property is true,
then don't do the normal stuff, though the Pushed, Focused and Over
(hot) states are allowed to override that. So you can get it to do some
fancy stuff according to your wishes.

--

Matthew Jones
Tue, Jun 14 2016 2:29 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Mark,

<< - Why has this functionality been suppressed in the base class? >.

Because it isn't used, so there's no reason to have the default functionality go through states that don't exist.

<< - How can I re-introduce it without changing Tim's source? >>>

Frankly, I would just create your own base panel control that does allow the default state functionality to work.  If you look at the TBasicPanel/TBasicPanelControl classes, they're only about 20 lines of code and consist primarily of simply publishing ancestor properties.

Tim Young
Elevate Software
www.elevatesoft.com
Tue, Jun 14 2016 6:37 PMPermanent Link

Mark Brooks

Slikware

Avatar

Matthew / Tim

Much appreciated. Will try this tomorrow.

Thanks
Mark
Image