Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 3 of 3 total
Thread Setting Image at runtime
Fri, Feb 20 2015 7:25 AMPermanent Link

Chris Holland

SEC Solutions Ltd.

Avatar

Team Elevate Team Elevate

Has anybody worked how how to change an image at runtime.

I have my image update depending upon a flag and am using:

if Appointment.Accepted = true then
 AcceptedImage.Background.Image.Name := 'GreenLed16.png'

but the image does not show.

--
Chris Holland
[Team Elevate]
Fri, Feb 20 2015 8:09 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Chris,

<< but the image does not show. >>

Is there already a background image on there from design-time/an interface ?
If so, then you're hitting a bug.  In the WebUITypes, remove the indicated
line below:

procedure TBackgroundImage.SetName(const Value: String);
begin
  if (Value <> FName) then
     begin
     FName:=Value;
     if (FName='') then    <<<<<<<<  Remove
        FData:='';
     DoChanged(scBackgroundChanged);
     end;
end;

That should fix it.

The problem is that the Data member is populated via the
design-time/interface settings, and that if condition prevents the Data
member from being cleared when you assign a Name at runtime.  The Data
member is for accepting straight-up base64-encoded data from the interfaces,
etc., and it takes precedence over the Name member.

Tim Young
Elevate Software
www.elevatesoft.com
Fri, Feb 20 2015 9:28 AMPermanent Link

Chris Holland

SEC Solutions Ltd.

Avatar

Team Elevate Team Elevate

Yes, that has fixed it.

Thanks Tim.

Chris Holland
[Team Elevate]

On 20/02/2015 13:09, Tim Young [Elevate Software] wrote:
> Chris,
>
> << but the image does not show. >>
>
> Is there already a background image on there from design-time/an
> interface ? If so, then you're hitting a bug.  In the WebUITypes, remove
> the indicated line below:
>
> procedure TBackgroundImage.SetName(const Value: String);
> begin
>    if (Value <> FName) then
>       begin
>       FName:=Value;
>       if (FName='') then    <<<<<<<<  Remove
>          FData:='';
>       DoChanged(scBackgroundChanged);
>       end;
> end;
>
> That should fix it.
>
> The problem is that the Data member is populated via the
> design-time/interface settings, and that if condition prevents the Data
> member from being cleared when you assign a Name at runtime.  The Data
> member is for accepting straight-up base64-encoded data from the
> interfaces, etc., and it takes precedence over the Name member.
>
> Tim Young
> Elevate Software
> www.elevatesoft.com
Image