0

Does anybody know if it's possible to use MoSync to create apps with a native UI?
From what I can tell all the UI/graphics is done with their own UI library and don't the the native ui elements.

Also, now that I'm creating a question anyway. Why does MoSync target specific telephones? Is it not possible to just create a generic install package for whatever platform you're targeting? (like .apk files for android). If it's possible it should make distribution easier.

ThinkingStiff
  • 64,767
  • 30
  • 146
  • 239
Rutger
  • 60
  • 1
  • 6

2 Answers2

1

The standard way up til now has been to create a custom non-native UI through the MAUI library. As of 2011-02-03 there is an experimental native UI framework for Android and iPhone. The user documentation is however rather non-existent, so you will have to check the source code for more information. I'll point you in the right direction, for accessing native widgets you use the maWidget* system calls defined in: maapi.idl. For a list of available widgets and properties see: Types.java. Note that this API is likely to change and be expanded.

A simple native UI example:

#include <MAUtil/Moblet.h>

#include <IX_WIDGET.h>

class NativeUIMoblet : public MAUtil::Moblet
{
public:
    NativeUIMoblet()
    {
        // Create a screen
        MAHandle mainScreen = maWidgetCreate( "Screen" );

        // Create a 'Hello World' label
        MAHandle helloLabel = maWidgetCreate( "Label" );
        maWidgetSetProperty( helloLabel, "text", "Hello World!" );

        // Add the label to the screen
        maWidgetAddChild( mainScreen, helloLabel );

        // Show the screen
        maWidgetScreenShow( mainScreen );
    }

    void keyPressEvent(int keyCode, int nativeCode)
    {

    }

    void keyReleaseEvent(int keyCode, int nativeCode)
    {

    }
};

extern "C" int MAMain()
{
    MAUtil::Moblet::run( new NativeUIMoblet( ) );
    return 0;
};

Presently, there is no emulator support available, so you will have to run it on a device or in a specific SDKs emulator.

The reason for targeting a specific phone is that there exists bugs specific to a certain device. But in the recent nightly builds of MoSync you can build for generic platforms like Android 2.1.

  • I would think that being able to make generic apk files is a rahter important feature. Would make it a lot easier to submit application to the app store. Mind you, I haven't actually used MoSync yet (doing research into different frameworks), so maybe I'm complaining about nothing. Anyway, thank you for answering :) – Rutger Feb 08 '11 at 08:26
1

http://www.mosync.com/blog/2011/03/using-nativeeditbox

MRae
  • 267
  • 5
  • 15
  • 2
    [Please provide context for links](http://stackoverflow.com/questions/how-to-answer). Whilst this may theoretically answer the question, [it would be preferable](http://meta.stackexchange.com/q/8259) to include the essential parts of the answer here, and provide the link for reference. – Gilles 'SO- stop being evil' Nov 12 '11 at 23:06