EnriqueGonzalez Expert Licensed User Longtime User Jun 24, 2017 #1 I get an error when calling something like this: Code: Copy For Each n As Node In MainForm.RootPane.GetAllViewsRecursive ' i would like to use a combination of subExists and callsub If n Is TextField Or n Is TextArea Then callsub2(n,"setText","") End If Next The first error is that the IDE says that there is not sub with that name Second is that it fails, it mentions that textfield cannot be converted to string. ducktyping only works for Classes created within the IDE? right now i am using javaObject: Code: Copy For Each n As Node In MainForm.RootPane.GetAllViewsRecursive If n Is TextField Or n Is TextArea Then Dim nJo As JavaObject = n nJo.runmethod("setText",Array("")) End If Next Thanks!
I get an error when calling something like this: Code: Copy For Each n As Node In MainForm.RootPane.GetAllViewsRecursive ' i would like to use a combination of subExists and callsub If n Is TextField Or n Is TextArea Then callsub2(n,"setText","") End If Next The first error is that the IDE says that there is not sub with that name Second is that it fails, it mentions that textfield cannot be converted to string. ducktyping only works for Classes created within the IDE? right now i am using javaObject: Code: Copy For Each n As Node In MainForm.RootPane.GetAllViewsRecursive If n Is TextField Or n Is TextArea Then Dim nJo As JavaObject = n nJo.runmethod("setText",Array("")) End If Next Thanks!
Cableguy Expert Licensed User Longtime User Jun 24, 2017 #2 The callsub methods expect a class ref where to search the sub, not a node... You could however use that approach if you use it with the tag property Each tag property should hold the node name and the use: Callsubdelayed(me,n.tag&"_setText","")
The callsub methods expect a class ref where to search the sub, not a node... You could however use that approach if you use it with the tag property Each tag property should hold the node name and the use: Callsubdelayed(me,n.tag&"_setText","")
EnriqueGonzalez Expert Licensed User Longtime User Jun 24, 2017 #3 Thank you CableGuy, that is actually a nice approach. But to correct you... technically a node is a class.
Thank you CableGuy, that is actually a nice approach. But to correct you... technically a node is a class.
Cableguy Expert Licensed User Longtime User Jun 24, 2017 #4 Enrique Gonzalez R said: Thank you CableGuy, that is actually a nice approach. But to correct you... technically a node is a class. Click to expand... The thing is, nodes are java classes, not b4j, and callsub is a B4J only kind of feature so it has its limitations or particularities
Enrique Gonzalez R said: Thank you CableGuy, that is actually a nice approach. But to correct you... technically a node is a class. Click to expand... The thing is, nodes are java classes, not b4j, and callsub is a B4J only kind of feature so it has its limitations or particularities
EnriqueGonzalez Expert Licensed User Longtime User Jun 24, 2017 #5 Yes, i know. I was hoping this was more of a bug than a limitation.
Erel B4X founder Staff member Licensed User Longtime User Jun 25, 2017 #6 This is not a bug. CallSub only works with B4X modules.