Q qsrtech Active Member Licensed User Longtime User May 19, 2015 #1 I noticed a lot of objects have an Initialize2 and even 3 or 4, but I can't seem to make this work within my classes. I tried calling the main Initialize, kinda like inheritance but it doesn't seem to work. I realize we can add parameters to the original Initialize but there is still no optional parameters feature. How does one go about doing this properly? Thanks.
I noticed a lot of objects have an Initialize2 and even 3 or 4, but I can't seem to make this work within my classes. I tried calling the main Initialize, kinda like inheritance but it doesn't seem to work. I realize we can add parameters to the original Initialize but there is still no optional parameters feature. How does one go about doing this properly? Thanks.
klaus Expert Licensed User Longtime User May 19, 2015 #2 You should explain what exactly you want to do ! Without knowing this it's impossible to give you a concrete advice. Upvote 0
You should explain what exactly you want to do ! Without knowing this it's impossible to give you a concrete advice.
Q qsrtech Active Member Licensed User Longtime User May 20, 2015 #3 I have to apologize. At first I was getting "Null" errors when trying to implement an Initialize2 method but everything seems to be working now. I don't know if it has something to do with forcing a complete recompile. Nevertheless it is working good so far. EDIT! Well unfortunately I have to take the apology back. I try to "Build release app" and compiler complains about a missing "," see attached [but runs fine in debug] Tried project clean. Funny thing is if I add a dummy parameter i.e. Initialize(Name,TargetModule,"") it complies fine but when app is run on device it crashes. Attachments Initialize2Issue.png 326.1 KB · Views: 457 Last edited: May 20, 2015 Upvote 0
I have to apologize. At first I was getting "Null" errors when trying to implement an Initialize2 method but everything seems to be working now. I don't know if it has something to do with forcing a complete recompile. Nevertheless it is working good so far. EDIT! Well unfortunately I have to take the apology back. I try to "Build release app" and compiler complains about a missing "," see attached [but runs fine in debug] Tried project clean. Funny thing is if I add a dummy parameter i.e. Initialize(Name,TargetModule,"") it complies fine but when app is run on device it crashes.
klaus Expert Licensed User Longtime User May 20, 2015 #4 Sorry, this is beyond my knowledge. I tested it in a small project and I get the same error. Upvote 0
Erel B4X founder Staff member Licensed User Longtime User May 21, 2015 #5 You must first call the Initialize method. This is true in B4i, B4A and B4J. Upvote 0
Q qsrtech Active Member Licensed User Longtime User May 21, 2015 #6 So there's not much point in having an initialize2? Still doesn't explain why it compiles/works in debug mode but not release. Upvote 0
So there's not much point in having an initialize2? Still doesn't explain why it compiles/works in debug mode but not release.
Erel B4X founder Staff member Licensed User Longtime User May 21, 2015 #7 qsrtech said: So there's not much point in having an initialize2? Click to expand... Not really. Only the Initialize method is a "special" method. It will also fail in debug mode in some cases (depending on the state of the installed app compared to the current code). Upvote 0
qsrtech said: So there's not much point in having an initialize2? Click to expand... Not really. Only the Initialize method is a "special" method. It will also fail in debug mode in some cases (depending on the state of the installed app compared to the current code).
Q qsrtech Active Member Licensed User Longtime User May 21, 2015 #8 Well i don't think it's fair (or consistent) that libraries can have them but we can't. Upvote 0