B4A Class [B4X] [XUI] SD BottoMenu (with source code)

SD_BottoMenu (update)

Author: Star-Dust
Version: 1.6
  • BottoMenu
    • Events:
      • Selected (Value As Int)
    • Fields:
      • BackGroundColor As Int
      • Position As Int
        ' get or set Position
    • Functions:
      • AddMenu (CharText As String, FontName As B4XFont) As String
      • Class_Globals As String
      • Clear As String
      • DesignerCreateView (Base As Object, Lbl As Label, Props As Map) As String
        Base type must be Object
      • Initialize (Callback As Object, EventName As String) As String
      • Invalidate As String
      • IsInitialized As Boolean
        Verifica se l'oggetto sia stato inizializzato.
      • SetValueAt(Position As Int, CharText As String, FontName As B4XFont)
      • TransitionAnimated (Duration As Int, FromBmp As B4XBitmap, ToBmp As B4XBitmap, ImageView As B4XView) As ResumableSub
Video1.gif
IMG_0110.PNG

Video4.gif
 

Attachments

  • SD_BottoMenu.b4xlib
    4 KB · Views: 704
Last edited:

Star-Dust

Expert
Licensed User
Longtime User
I attach the test I did on the
Samsung S6 .......... Xiaomi Mi 9

Samsung-S6.gif
Xiaomi Mi 9.gif


Here the tests on Samsung Tab3 - 7" (T310)
Samsung Tab3 7.png
Samsung Tab3 7B.png


All tests were successful. Now we can continue to post images and photos all day. But it wouldn't solve the problem.
Are you using the original project I have attached?
 
Last edited:

CaptKronos

Active Member
Licensed User
Yes, as I said, I'm using aSample1 from post #2. I didn't make any changes to your project. But don't worry about it. I might take a look at your code and let you know if I find the problem. Thanks.
 

Star-Dust

Expert
Licensed User
Longtime User
Yes, as I said, I'm using aSample1 from post #2. I didn't make any changes to your project. But don't worry about it. I might take a look at your code and let you know if I find the problem. Thanks.
Unfortunately, if I can't reproduce the error, I can't correct it. I am using your own devices.

My tests are done on Samsung Tab2, Tab3, S6. Asus Zenfone 2, Xiaomi Mi 9, Honor 9, Huawey MediaPad M3, Huawey MediaPad T3, Viko Jam, iPhone 6.
 

CaptKronos

Active Member
Licensed User
Hi SD, I had a look at your code and the reason I am seeing the corruption is that TransitionAnimated doesn't necessarily complete before the user clicks the label again. Adding a Wait For to TransitionAnimated fixes that problem but then the GUI is less responsive. Adding a flag to TransitionAnimated to terminate the animation early and go straight to the end state fixes the problem. Dangles has a similar issue which I didn't bother fixing since I think I prefer BottoMenu without the Dangles animation. Also, removing the call to Dangles and the following Sleep(500) makes the interface a lot more responsive. Anyway, thanks for the great library.
 

Star-Dust

Expert
Licensed User
Longtime User
I deliberately avoided speeding up the closing of the previous animation, because it could create other problems.

In rel. 1.41 with the "semaphore" flag I can stop the following animations until the previous one completes.
You may have used a version earlier than 1.41, otherwise you have not experienced this problem

B4X:
If semaphore=False Then 
    semaphore=True
    ' .... other code
    Dangles(B4XL)
    Sleep(500) 'It waits 500ms, i.e. the duration of the animation, before reactivating the semaphore FLAG
    semaphore=False
END IF
 
Last edited:

CaptKronos

Active Member
Licensed User
I am definitely using 1.41 since I can see your semaphore code. I don't think it is safe to assume the animation will complete within the exact specified duration, at least it doesn't seem to work on my devices. Anyway, I have now also fixed the Dangles code. I'll PM the code to you, just in case you want to take a look. (I have only changed the B4A elements.) It is strange that the problem doesn't show up on your devices since on the two devices (S8 and an old Yotaphone) I have tried the problem materializes almost immediately.
 

Star-Dust

Expert
Licensed User
Longtime User
The animation lasts around 400ms, so 500ms is enough. It may be that for some reason your devices are slower, perhaps some other app installed. I always keep my devices efficient and cleaned up to prevent external factors from affecting the tests.

In any case, I will try to find a solution for devices that can present such problems. I'll probably use Wait For's suggestion
 

CaptKronos

Active Member
Licensed User
The version I sent you doesn't require Wait For. You are probably correct about slower devices. It's a shame that my S8 now falls within that bracket!
 

Star-Dust

Expert
Licensed User
Longtime User
The version I sent you doesn't require Wait For. You are probably correct about slower devices. It's a shame that my S8 now falls within that bracket!
My S6 is older it doesn't have this problem, so I suggest you check it out
 

Star-Dust

Expert
Licensed User
Longtime User
Update rel. 1.6
 

ronnhdf

Member
Licensed User
Longtime User
Good day,

Very good work. Is it possible to change the color at runtime?
set BackGroundColor is not working

LG Ronny
 

Star-Dust

Expert
Licensed User
Longtime User
In the first post there is the source code, you can modify it to get this function
 
Top