German Anfängerfrage Code Module Parameterübergabe

psciga

Active Member
Licensed User
Longtime User
Hallo,

ein wenig peinlich ist es mir schon, aber ich komme einfach nicht weiter beim Thema Code Module. Darin steht eine ganz banale Sub:

B4X:
'Code module
'Subs in this code module will be accessible from all modules.
Sub Process_Globals
   'These global variables will be declared once when the application starts.
   'These variables can be accessed from all modules.
   Type ko(xKoord As Float, yKoord As Float)
   Dim koordKarte As ko
End Sub

Sub test1(kx As Float, ky As Float)
   koordKarte.xKoord = kx
   koordKarte.yKoord = ky
   Return koordKarte
End Sub

die Sub test 1 soll im Hauptprogramm aufgerufen werden:

B4X:
'Activity module
Sub Process_Globals
   'These global variables will be declared once when the application starts.
   'These variables can be accessed from all modules.
   Dim koka As ko
End Sub

Sub Globals
   'These global variables will be redeclared each time the activity is created.
   'These variables can only be accessed from this module.
End Sub

Sub Activity_Create(FirstTime As Boolean)
   koka = helpmodul.test1
   Msgbox(koka.xKoord)
End Sub

Sub Activity_Resume
End Sub

Sub Activity_Pause (UserClosed As Boolean)
End Sub

Daraufhin bringt der Compiler eine Type-Fehler:

B4X:
Compiling code.                         0.00
Generating R file.                      0.00
Compiling generated Java code.          Error
B4A line: 14
koka = helpmodul.test1(88.88, 77.77)
javac 1.6.0_21
src\peter\b4a\modultest\main.java:210: inconvertible types
found   : java.lang.String
required: peter.b4a.modultest.helpmodul._ko
_koka = (helpmodul._ko)(mostCurrent._helpmodul._test1(mostCurrent.activityBA,(float)(88.88),(float)(77.77)));
                       ^
1 error

Was mache ich hier falsch?

Danke im Voraus - Peter
 

Attachments

  • modultest.zip
    5.8 KB · Views: 227
Top