B4A Library [B4X] B4XGifView - Cross platform animated gif view

Beja

Expert
Licensed User
Longtime User
Hi Erel,
Tried to run the B4A example and got this error message.. Any meaning appreciated..

Could not find file 'C:\B4A95\libraries\relinker-1.3.1.aar'.
 

Beja

Expert
Licensed User
Longtime User
You need to download B4A-dependencies.zip, unzip it and copy the files to the additional libraries folder. It is attached to the first post.

Perfect.. working like a charm.. the two GIF files loaded in no time and started immediately!!

Thanks Erel
 

AnandGupta

Expert
Licensed User
Longtime User
Can I Start & Stop Animation ?
See

Regards,

Anand
 

Guenter Becker

Active Member
Licensed User


Hello, hope you are well.
Is it possible and if yes how to do it, to start/stop the animation by code?I
Is it possible and if yes how to do it, to start/stop repeating the animation by code?
 

Daica

Active Member
Licensed User
Hi Erel, do you think you can add a click event to this library?
Thank you!

I tried editing the source code and added:

B4X:
#Event: Click

Private Sub iv_Click
    If xui.SubExists(mCallBack,mEventName&"_Click",0) Then
        CallSub(mCallBack,mEventName&"_Click")
    End If
End Sub

Nothing happens when I click the view. I think I might be doing something wrong?
 
Last edited:

Unobtainius

Active Member
Licensed User
Longtime User
it could be other languages I am used to but
mEventName&"_Click"
in a continuous line looks odd to me
does
mEventName & "_Click" work?
 

Daica

Active Member
Licensed User
it could be other languages I am used to but
mEventName&"_Click"
in a continuous line looks odd to me
does
mEventName & "_Click" work?

I tried to format it correctly but nothing happens when I click. Maybe the view that is being returned isn't the one that is actually being clicked on?
 

Unobtainius

Active Member
Licensed User
Longtime User
Sorry I cant help much I've never dived into the source code of any of the controls before but I think you may be on the right track.
They are usually made up of a few control and IV is like the base for getting at the other controls, so yeah, dig a bit deeper, the click event of some of the other controls may yield a result. Good luck
 

Unobtainius

Active Member
Licensed User
Longtime User
Also, it's best not to post questions directly at Erel, as we are all here to help if we can.
plus @klaus will tell you off
 

Daica

Active Member
Licensed User
Also, it's best not to post questions directly at Erel, as we are all here to help if we can.
plus @klaus will tell you off

I know there are many great talented people here, I just assumed since Erel created it, I should direct the attention of the person writing the library.
 

LucaMs

Expert
Licensed User
Longtime User
The wrong thing is that you should also set the event name when the ImageView is initialized, within the DesignerCreateView routine:
B4X:
Public Sub DesignerCreateView (Base As Object, Lbl As Label, Props As Map)
    mBase = Base
    Tag = mBase.Tag
    mBase.Tag = Me
    #if B4J
    iv.Initialize("iv") '<--------- here
    mBase.AddView(iv, 0, 0, mBase.Width, mBase.Height)
    #Else If B4i
    Dim no As NativeObject
    AnimatedImageView = no.Initialize("FLAnimatedImageView").RunMethod("new", Null)
    mBase.AddView(AnimatedImageView, 0, 0, mBase.Width, mBase.Height)
    Dim iv As ImageView = AnimatedImageView
    iv.ContentMode = iv.MODE_FIT
    #Else If B4A
    iv.Initialize("iv") ' <--------- here
    mBase.AddView(iv, 0, 0, mBase.Width, mBase.Height)
    #End If
End Sub
As you can see I did it and it works but I couldn't do it for B4i.

I'm attaching a version (1.12) that works with B4A and B4J; Erel will probably be able to fix it to work with B4i as well.
 

Attachments

  • B4XGifView.b4xlib
    1.5 KB · Views: 250
Last edited:

Daica

Active Member
Licensed User
The wrong thing is that you should also set the event name when the ImageView is initialized, within the DesignerCreateView routine:

Ahh of course, there is no event name so there is no _click event for the iv.
 

aeric

Expert
Licensed User
Longtime User
It works for B4J and B4A.
I tried to make it work with B4i but no success.
In B4i, when I don't have an image loaded, the click event is fired but once I loaded a Gif file, the click event is not fired.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…