Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 7 of 7 total
Thread TIcon enable/disable
Mon, Jun 12 2017 2:58 PMPermanent Link

Trinione

Hi:
How can the TIcon be disabled? For example a button can be disabled and I would like to do same with an Icon so when the user clicks on the icon, nothing happens.

Thanks,
Trinione
Mon, Jun 12 2017 5:32 PMPermanent Link

Raul

Globestar Systems

Team Elevate Team Elevate

On 6/12/2017 2:58 PM, Trinione wrote:
> Hi:
> How can the TIcon be disabled? For example a button can be disabled and I would like to do same with an Icon so when the user clicks on the icon, nothing happens.

you need to disable it in code

Icon1.Enabled := false;

It has the Enabled property, just not in object inspector.

Raul
Tue, Jun 13 2017 3:15 PMPermanent Link

Trinione

Raul wrote:
>>
you need to disable it in code
Icon1.Enabled := false;
<<

Great! Thanks. That works.

However, the following does not work. Frown

   if ctrl.Controls[i] is TIcon then
   begin
     ico := TIcon(ctrl.Controls[i]);
     ico.Enabled := bol;
   end;
Tue, Jun 13 2017 5:05 PMPermanent Link

Raul

Globestar Systems

Team Elevate Team Elevate

On 6/13/2017 3:15 PM, Trinione wrote:
> However, the following does not work. Frown
>
>      if ctrl.Controls[i] is TIcon then
>      begin
>        ico := TIcon(ctrl.Controls[i]);
>        ico.Enabled := bol;
>      end;

This works fine here.

Make sure your ctrl is actual direct parent of the icon and bol has the
value you want.

Raul
Wed, Jun 14 2017 1:35 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

<< How can the TIcon be disabled? For example a button can be disabled and I would like to do same with an Icon so when the user clicks on the icon, nothing happens. >>

I would recommend using the TIconButton in such a case.  It has support for a disabled state, as well as showing a pushed state.  The TIcon is only intended to be used for displaying icons, period.

Tim Young
Elevate Software
www.elevatesoft.com
Wed, Jun 14 2017 11:04 PMPermanent Link

Trinione

<< I would recommend using the TIconButton in such a case.  It has support for a disabled state, as well as showing a pushed state.  The TIcon is only intended to be used for displaying icons, period. >>

Tim:
This is for a general routine to disable the components based on their type. So, there would be times when a TIcon would be need to be disabled also.

I am not seeing information or an example on how to set the TIConButton disabled state though.
Fri, Jun 16 2017 1:07 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com


<< This is for a general routine to disable the components based on their type. So, there would be times when a TIcon would be need to be disabled also. >>

Yes, but as I said, the TIcon *isn't designed to be used this way*.  In other words, don't expect changes to this effect when there's a TIconButton control that *does* behave in the manner that you want.

<< I am not seeing information or an example on how to set the TIConButton disabled state though. >>

This is an oversight, in terms of published properties.  A fix will be in 2.06 B3.

However, at run-time you can still do this:

MyIconButton.Enabled:=False;




Tim Young
Elevate Software
www.elevatesoft.com
Image