B4J Question Help with B4j Library

stevel05

Expert
Licensed User
Longtime User
Would it be possible to get some help with this library please?

The zip file attached, includes a B4j project, the compiled Jar and Xml files for the library and an Eclipse project for the library.

It all works fine in release mode, but in Debug mode I get an error when the listview is refreshed (the cell factory and call to the B4a code works first time even in Debug mode).

Run the project then click the First,Last checkbox.

As I said, in Release mode it works as intended, in Debug mode I get an error message:
B4X:
Unexpected event (missing RaiseSynchronousEvents): gettext

What can't I see? (or more likely don't know enough to find)

Thanks
 

stevel05

Expert
Licensed User
Longtime User
Thanks Erel,

As the sub is ultimately called from a Callback, I'm not sure where to put the annotation. I tried on the getGraphic and getText subs of cellfactoryobject, and the call and Initialize subs of CellFactoryHelper, but it doesn't seem to make a difference. Eclipse won't let me annotate the Overridden cell sub.
 
Last edited:
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
This message means that the developer called a method (M1) which caused an event to be raised before the method (M1) returned.

You need to mark M1 with this annotation. It can be a method in a different library.
You can go over the code execution with the debugger step by step to find the method.
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
OK got it, thanks for your explanation and patience, it was a sub in a B4j code module, moved it to its own class. It now works, without the annotation (I just had to check). Is there a simple reason that this is the case?
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
Not sure why it works from a class and not from the code module.

@Erel Just an extra piece of info, not at all urgent, and only if it intrigues you enough.

I had the same issue, and moved the call to a class, and it went away. I then created a new empty class, Dimmed and initialized that and called the sub from the original code module, and still no error.

In fact, if I Dim and Initialize the empty class in the called sub in the code module, the error goes away too. It appears it's not the fact that the sub is in a class as opposed to a code module, but that a class has been initialized.

Run the app and click the first last button, the error will appear.

If you would like to check it, remove the comments from lines 71/72 of Main and the error will disappear. (Needs the jCellFactoryHelper Lib)
 

Attachments

  • UnexpectedEvent.zip
    13.7 KB · Views: 112
Last edited:
Upvote 0
Top