iOS Question I hope Display Delay effect about ToastMessageShow

winjiadh

Active Member
Licensed User
Longtime User
use the iHUD library
search in forum
I found https://www.b4x.com/android/forum/threads/b4x-callsubplus-callsub-with-explicit-delay.60877/#content
use CallSub with explicit delay
I hope a effect for three ToastMessageShow disappear one by one
my code is
B4X:
Dim    csu As CallSubUtils

    csu.CallSubDelayedPlus(Me,DisMessage(1),10000)
    csu.CallSubDelayedPlus(Me,DisMessage(2),5000)
    csu.CallSubDelayedPlus(Me,DisMessage(3),400)
but the three message display in same time,and disappeared same time
like the delay time is no used
I need you help
I post all zip file
thank you for all
 

Attachments

  • Delay.zip
    5.7 KB · Views: 211

Erel

B4X founder
Staff member
Licensed User
Longtime User
You are not using CallSubUtils correctly.
1. Initialize it in Application_Start and don't dim it again.
2. You need to pass the sub name. Your code directly calls the sub.
B4X:
Sub Button1_Click
   csu.CallSubDelayedPlus2(Me, "DisMessage" ,400,  Array("First Message"))
   csu.CallSubDelayedPlus2(Me, "DisMessage" ,5000,  Array("Second Message"))
End Sub

Private Sub DisMessage(args() As Object)
   hd.ToastMessageShow(args(0),True)
   SetHUDOffset(Page1.RootPanel.Height / 2 - 100) 'note that RootPanel height will be 0 in Application_Start
End Sub
 
Upvote 0

winjiadh

Active Member
Licensed User
Longtime User
Thanks Erel
I change code like you post,It's display fine, the "First Message" disappeared and the "Second Message" will display in the same site.
and I change it
B4X:
Sub Button1_Click
    csu.CallSubDelayedPlus2(Me, "DisMessage" ,400,  Array("First Message"))
    csu.CallSubDelayedPlus2(Me, "DisMessage" ,5000,  Array("Second Message"))

End Sub

Private Sub DisMessage(args() As Object)
    hd.ToastMessageShow(args(0),True)
    If args(0)="First Message" Then
        SetHUDOffset(Page1.RootPanel.Height / 2 - 100) 'note that RootPanel height will be 0 in Application_Start
    else if args(0)="Second Message" Then
        SetHUDOffset(Page1.RootPanel.Height / 2 - 200)
    End If
End Sub
It's so cool.
and thank you again
I have a question, Two or more ToastMessageShow can't show the same time, and disappeared not at the same time.
 
Last edited:
Upvote 0
Top