Wish Shared class module name

azzam223

Active Member
Licensed User
Longtime User
I wish if I can use class module like Code module To share it's subs in another module

for example

B4X:
public sub  Sharedsub
''Some code
end sub

when i want to use this in another module I only call class name then subs like code module

for example

B4X:
dim s as int=sharedclass.sharedsub

I know I can use code module for this but I want Also use class module because I want to create private sub and shared sub in it without declare the class in another module

for example 'Hello' class module

B4X:
public class module 
public name as string
end sub

public hi(name as string) 
return "Hi " + name
end sub

in another module for example 'main'

when i want to call shred hi sub from main module

I must first declare Hello class

B4X:
dim hi as hello
dim msg as string
msg=hi.hi("Every one")
If I has multi shared sub in different classes It's difficult To declare every class

I wish If I can Use it like code module
 

azzam223

Active Member
Licensed User
Longtime User
ok thanks erel can i use callsub to return value from class module
 
Last edited:

azzam223

Active Member
Licensed User
Longtime User
No I mean Standard Class I want to call it sub without declare it like code module
B4X:
Sub Class_Globals' Name is Category
  
End Sub
public sub loadAllCategory as list
end sub
'Initializes the object. You can add parameters to this method if needed.
Public Sub Initialize

End Sub

I want to call the sub 'loadallcategory' from other standard class like this

B4X:
Sub Class_Globals ' name
  
End Sub
public sub Load
Callsub(category,"loadallcategory")' when i try put category name I can not see it in list

end sub
'Initializes the object. You can add parameters to this method if needed.
Public Sub Initialize

End Sub
I must declare it and put it variable in callsub
 
Last edited:
Top