santpiedra / appinventor-java-translation

Automatically exported from code.google.com/p/appinventor-java-translation
0 stars 0 forks source link

Arguments missing from the event handler methods #6

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Make a canvas, make brick containing the Dragged-event
2. Convert
3. Look in src

What is the expected output? 

    private void Canvas1_Dragged( float startX, float startY, float prevX, float prevY, float currentX, float currentY, boolean draggedSprite )
    {
...

    public void dispatchEvent( Object component, String id, String eventName, Object[] args )
    {
...
        if( eventName.equals( "Dragged" ) && component.equals( cnvDrawingCanvas ))
            cnvDrawingCanvas_Dragged( (Float)args[0], (Float)args[1], (Float)args[2], (Float)args[3], (Float)args[4], (Float)args[5], (Boolean)args[6] );

What do you see instead?

    private void Canvas1_Dragged()
    {
... (noncopmpi)
}

    public void dispatchEvent( Object component, String componentName, String eventName, Object[] params )
    {
...
        if( component.equals( Canvas1 ) && eventName.equals( "Dragged" ) )
        {
            Canvas1_Dragged();
        }

What version of the product are you using? On what operating system?

trunk from SVN

Of course, this can be fixed manually. Other people might use the above manual 
fix as a workaround untill the code generation has been fixed.

Original issue reported on code.google.com by jacob.nordfalk on 20 Jun 2012 at 10:01

GoogleCodeExporter commented 8 years ago
This is one of what I see as the two biggest/most-work-to-fix issues with the 
translator.

However, in order to fix this, someone will need to map all of the event 
handlers in order to make them accept the right types. This will be a lot of 
work and I haven't even begun to think about what format that data should be 
stored in.

Original comment by clhoda...@gmail.com on 20 Jul 2012 at 5:17

GoogleCodeExporter commented 8 years ago

Original comment by clhod...@crimson.ua.edu on 20 Jul 2012 at 8:01

GoogleCodeExporter commented 8 years ago
It seems that it worked a some earlier point in time.

For example, 
http://code.google.com/p/appinventor-java-translation/source/browse/appinventor-
java-translation/examples/PaintPot/src/com/Android/paintpot/PaintPot.java 
correctly defines the parameters:

private void cnvDrawingCanvas_Dragged( float startX, float startY, float prevX, 
float prevY, float currentX, float currentY, boolean draggedSprite )

Original comment by jacob.nordfalk on 21 Jul 2012 at 10:37