Best way to show/animate loading on VL-WEB

This Q&A forum allows users to post and respond to "How Do I Do ....." questions. Please do not use to report (suspected) errors - you must use your regional help desk for this. The information contained in this forum has not been validated by LANSA and, as such, LANSA cannot guarantee the accuracy of the information.
Post Reply
atostaine
Posts: 696
Joined: Wed Jan 20, 2016 7:38 am

Best way to show/animate loading on VL-WEB

Post by atostaine »

I am loading many images into a viewer, similar to the image carousel from the samples. I'd like to show a loading animation. I can't find any examples of that. I thought I saw that somewhere.

The image that shows while first opening a web page would be fine.
Art Tostaine
jyoung
Posts: 694
Joined: Thu Jan 21, 2016 6:43 am
Location: Oklahoma City, OK USA

Re: Best way to show/animate loading on VL-WEB

Post by jyoung »

Drop an image on you page and then use

Code: Select all

evtroutine handling(#COM_OWNER.CreateInstance)
#LoadingImage.Image <= #SYS_WEB.LoadingImage
endroutine
Then you can show/hide your image as needed.

https://docs.lansa.com/14/en/lansa016/p ... gimage.htm
atostaine
Posts: 696
Joined: Wed Jan 20, 2016 7:38 am

Re: Best way to show/animate loading on VL-WEB

Post by atostaine »

Thanks Joe. I did see how to define the image, how do you show it? I'm waiting for the easy answer I should have known.

art
Art Tostaine
jyoung
Posts: 694
Joined: Thu Jan 21, 2016 6:43 am
Location: Oklahoma City, OK USA

Re: Best way to show/animate loading on VL-WEB

Post by jyoung »

Set the visibility of your loading image.

Code: Select all

evtroutine handling(#PTORequestDetailPanel.Loading)
#LoadingImage.Visible := True
#PTORequestDetailPanel.Visible := False
#ButtonPanel.Visible := False
endroutine

evtroutine handling(#PTORequestDetailPanel.Loaded)
#LoadingImage.Visible := False
#PTORequestDetailPanel.Visible := True
#ButtonPanel.Visible := True
endroutine
Sometimes if your loading is really fast you may not see the image.
atostaine
Posts: 696
Joined: Wed Jan 20, 2016 7:38 am

Re: Best way to show/animate loading on VL-WEB

Post by atostaine »

Oh I see. You actually have an image control, I thought I had seen something in sys_web to set it to visible true.

Thanks
Art Tostaine
jyoung
Posts: 694
Joined: Thu Jan 21, 2016 6:43 am
Location: Oklahoma City, OK USA

Re: Best way to show/animate loading on VL-WEB

Post by jyoung »

Right, you got to get an image control on the page, then set the reference to the SYS_WEB.LoadingImage to get the spinner gif. After that, then you can toggle the visibility of your loading image as required.

As far as I know, the SYS_WEB.LoadingImage is just there as a reference to get access to the gif. I think because you can't add a gif as a bitmap to the repo.

Joe
BrendanB
Posts: 134
Joined: Tue Nov 24, 2015 10:29 am

Re: Best way to show/animate loading on VL-WEB

Post by BrendanB »

If you place your gif files in webserver/Images directory then you can do:

#LoadingImage.Filename := 'http://anotherwebserver/Images/mygif.gif'

or:

#LoadingImage.Filename := '/Images/mygif.gif'


to set the image to a mygif.gif. In the first case, you can see that you could store the gif files on another webserver, but if they are on the same server you can omit the 'http://anotherwebserver' part of the filename.

yes, it doesnt use the repository, but it means you can use other gifs in your programs/rps.
dannyoorburg
Posts: 177
Joined: Mon Jan 04, 2016 9:50 am
Location: Australia

Re: Best way to show/animate loading on VL-WEB

Post by dannyoorburg »

If you do want to use the Repository, register your gif as an External Resource in the Partition VL-Web folder

The External Resource is now just another LANSA object in your App and you can even refer to it in your code.


#Image.FileName := #MyExternalResource


Danny
User avatar
Dino
Posts: 477
Joined: Fri Jul 19, 2019 7:49 am
Location: Robbinsville, NC
Contact:

Re: Best way to show/animate loading on VL-WEB

Post by Dino »

Can you style this image? like adding a text under it, change the background color of the screen while it appears, etc.?
Post Reply