Join Now
Quality Rating:
  • Currently 0.0 / 5
(0.0 / 5 - 0 votes cast)
Expertise Level:
  • Currently 0.0 / 5
(0.0 / 5 - 0 votes cast)

This page was last modified 13:52, 16 April 2008.

Usando as Teclas das Plataformas S60 e Maemo

From Forum Nokia Wiki

Original: Using_hardware_keys_with_S60_and_Maemo_Platform


Comparação

Os dispositivos de ambas as plataformas S60 e Maemo têm um número de teclas que os desenvolvedores podem usar. O número de teclas disponíveis varia entre diferentes dispositivos. Ambas as plataformas têm dispositivos com teclado QWERTY total. Por exemplo, o E90 Communicator e o Nokia N810 Internet Tablet.

Image:Nokia_E90.png Nokia E90 Communicator

Image:Nokia_N810.png Nokia N810 Internet Tablet

Comparando as Plataformas S60 e Maemo

Plataforma S60

Image:S60HWKeys.png

\epoc32\include\e32keys.h

enum TStdScanCode
	{
...
	EStdKeyLeftArrow=0x0e,                /**< Scan code for Left arrow key.*/
	EStdKeyRightArrow=0x0f,               /**< Scan code for Right arrow key.*/
	EStdKeyUpArrow=0x10,                  /**< Scan code for Up arrow key.*/
	EStdKeyDownArrow=0x11,                /**< Scan code for Down arrow key.*/
...
	};
// ----------------------------------------------------
// CAknExEditorAppUi::HandleKeyEventL
// Handles key events.
// 
// ----------------------------------------------------
//
TKeyResponse CUTFViewerAppUi::HandleKeyEventL( 
    const TKeyEvent& aKeyEvent,TEventCode aType )
    {
    if ( aType == EEventKey)
    	{
    	switch ( aKeyEvent.iScanCode )
    	{
        case EStdKeyUpArrow:
...
    	}
    return EKeyWasNotConsumed;
    }

Plataforma Maemo

Image:MaemoHWKeys3.png

typedef struct _AppData AppData;
 
struct _AppData
{
    HildonProgram *program; /* handle to application */
    HildonWindow *window; /* handle to app's window */
    osso_context_t *osso; /* handle to osso */
};
/* Creates and initialises a main_view */
MainView* interface_main_view_new( AppData *data )
{
    /* Zero memory with g_new0 */
    MainView* result = g_new0( MainView, 1 );
    ...
    /* Add hardware button listener to application */
    g_signal_connect(G_OBJECT(result->data->window),
        "key_press_event", G_CALLBACK(callback_key_press), result);
    ...
}
/* Callback for hardware keys */
gboolean callback_key_press(GtkWidget * widget, GdkEventKey * event, gpointer data)
{ 
    switch (event->keyval) {
 
    case HILDON_HARDKEY_UP:
        callback_up( NULL, data );
        return TRUE;
 
    case HILDON_HARDKEY_DOWN:
        callback_down( NULL, data );
        return TRUE;
 
    case HILDON_HARDKEY_LEFT:
        callback_left( NULL, data );
        return TRUE;
 
    case HILDON_HARDKEY_RIGHT:
        callback_right( NULL, data );
        return TRUE;
 
    case HILDON_HARDKEY_SELECT: 
        callback_reset( NULL, data );
        return TRUE;
 
    case HILDON_HARDKEY_FULLSCREEN:
        callback_fullscreen( NULL, data );
        return TRUE;
 
    case HILDON_HARDKEY_INCREASE:
        return FALSE;
 
    case HILDON_HARDKEY_DECREASE :
        return FALSE;
 
    case HILDON_HARDKEY_ESC :
        return FALSE;
 
    }
    return FALSE;
}
Related Discussions
Thread Thread Starter Forum Replies Last Post
What is the best S60 3rd machine for developer? zesky General Symbian C++ 6 2008-01-03 02:28
createImage leaks memory mariusfahlbusch Mobile Java General 20 2005-02-07 10:36
abld helloworld出错,真是郁闷阿! lorjer Symbian 3 2004-11-12 13:43
Problem installing Carbide.vs 3.0 lpvalente Symbian Tools & SDKs 3 2007-11-19 14:30
Camera madness on 3rd ed simo.salminen General Symbian C++ 2 2006-06-21 07:58
 
Powered by MediaWiki