Pooya1 Active Member Licensed User Feb 13, 2018 #1 Hello I have a class that contain functions Each function have argument (module and event) And return result according to function usage Example: Code: Copy Sub Number2Word(Module As Object,Event as String,Number As Int) If Number = 1 Then CallSubDelay2(Module,Event,"One") Else If Number = 2 Then CallSubDelay2(Module,Event,"Two") End if End Sub And call this function with below code Code: Copy Sub Page1_Resize(Width As Int,Height As int) Dim fu As Convert fu.Initialize fu.Number2Word(Me,"Result_Convert",1) End Sub Sub Result_Convert(Res As String) log(res) End Sub In mention code,when i call Number2Word,it does not raise Result_Convert I try to check why didn't raised and i understood Module argument is null
Hello I have a class that contain functions Each function have argument (module and event) And return result according to function usage Example: Code: Copy Sub Number2Word(Module As Object,Event as String,Number As Int) If Number = 1 Then CallSubDelay2(Module,Event,"One") Else If Number = 2 Then CallSubDelay2(Module,Event,"Two") End if End Sub And call this function with below code Code: Copy Sub Page1_Resize(Width As Int,Height As int) Dim fu As Convert fu.Initialize fu.Number2Word(Me,"Result_Convert",1) End Sub Sub Result_Convert(Res As String) log(res) End Sub In mention code,when i call Number2Word,it does not raise Result_Convert I try to check why didn't raised and i understood Module argument is null
Erel B4X founder Staff member Licensed User Longtime User Feb 14, 2018 #2 Does it work if fu is a global variable? Can you create a small example and upload it? Upvote 0
Pooya1 Active Member Licensed User Feb 14, 2018 #3 Erel said: Does it work if fu is a global variable? Can you create a small example and upload it? Click to expand... Please let me test it (declare in globals) Upvote 0
Erel said: Does it work if fu is a global variable? Can you create a small example and upload it? Click to expand... Please let me test it (declare in globals)
Pooya1 Active Member Licensed User Feb 14, 2018 #4 Om i have question about class and declare it Is it bad if i declare variable of any class inline? (not declare in global) Is it affecting on app? Upvote 0
Om i have question about class and declare it Is it bad if i declare variable of any class inline? (not declare in global) Is it affecting on app?
Erel B4X founder Staff member Licensed User Longtime User Feb 14, 2018 #5 No. It is fine. You can create local class instances as long as you don't need the class instance to be kept alive. It was just a guess as there isn't enough information here to say anything. Upvote 0
No. It is fine. You can create local class instances as long as you don't need the class instance to be kept alive. It was just a guess as there isn't enough information here to say anything.
Pooya1 Active Member Licensed User Feb 14, 2018 #6 Erel said: No. It is fine. You can create local class instances as long as you don't need the class instance to be kept alive. It was just a guess as there isn't enough information here to say anything. Click to expand... Yes your guess it right,for kept alive class,we can declare it in global and for keep local,declare in function or relate scope Thanks Upvote 0
Erel said: No. It is fine. You can create local class instances as long as you don't need the class instance to be kept alive. It was just a guess as there isn't enough information here to say anything. Click to expand... Yes your guess it right,for kept alive class,we can declare it in global and for keep local,declare in function or relate scope Thanks
Pooya1 Active Member Licensed User Feb 14, 2018 #7 My problem solved I made mistake in writing code Thanks Upvote 0