Home > Products > SophiaFramework UNIVERSE > BREW Tab Browser by SophiaFramework UNIVERSE

BREW Tab Browser by SophiaFramework UNIVERSE

Preface

This page outlines the programming procedure to build a Tab Browser for BREW enabled mobile phones using SophiaFramework UNIVERSE.

* Source code for Tab Browser can be downloaded with the free trial of SophiaFramework UNIVERSE. (SophiaFramework UNIVERSE is available only in Japanese)

Tab Browser

Tab Browser is a sample application for SophiaFramework UNIVERSE.

Tab Browser Screen

It uses the following SophiaFramework UNIVERSE Standard Control Classes.

Restrictions on Tab Browser

  1. The SFRBrowserControl class used in Tab Browser employs the IHtmlViewer, the standard BREW interface to handle HTML documents. IHtmlViewer has some restrictions for image formats, file paths and text encoding (only for Shift-JIS).
  2. Pressing the "1 key" enables the "page menu" to be displayed when selecting a hyperlink. Pressing the "2 key" desables the "page menu".
  3. The "favorites" page can not be edited. To clear the favorites page, delete the "favorite.dat" file using the BREW AppLoader.
  4. IHtmlViewer also does not support redirection, so links that have been moved must be clicked manually.

Using the Tab Browser

The following keys are used to operate Tab Browser.

  1. Left soft key: Gives focus to the next left tab
  2. Right soft key: Gives focus to the next right tab
  3. Power key: Quits Tab Browser
  4. Select key: Select the focused UI object
  5. ← key: When using the browser it returns to the previous page
    / When toggling tabs it chooses the next tab on the left side
    Other situations : Moves focus to next left UI object
  6. → key: When using the browser it advances to the next page
    / When toggling tabs it chooses the next tab on the right side
    Other situations : Moves focus to next right UI object
  7. ↑ key: When using the browser it scrolls up
    / Other situations : Moves focus to UI object above ( if applicable )
  8. ↓ key: When using the browser it scrolls down
    / Other situations : Moves focus to UI object below ( if applicable )
  9. Cancel key: When using the browser it moves focus out of the browser

When using Tab Browser for the first time, the favorites section should contain a "*URL Input*" item and an "example page" item.

Choose "*URL Input*" to input a URL, or choose "example page" to go to a demonstration page by Sophia Cradle.

Pressing the Select key while a hyperlink is highlighted jumps to the linked page. If the "1 key" is pressed, selecting a hyperlink generates the "page menu". The "page menu" can be disabled by pressing the "2 key".

 

Name and Function of Browser Window Controls

  1. Reload : Reloads the displayed page
    ( SFRButtonControl )
  2. Close: Closes the displayed page
    ( SFRButtonControl )
  3. Favorites menu: Displays favorites page
    ( SFRComboboxControl )
  4. Set options: Displays the options page
    ( SFRButtonControl )
  5. Browser tab: Shows browser tab
    ( SFRTabControl )

Tab Browser development process


Development Screen Shot 1    Development Screen Shot 2

* Click image, then click the bottom left icon in the window for an enlarged image

Tab Browser Sample Code

Tab Browser Sample Code 1

//
// When select key is pressed in tab control
//
HANDLER_IMPLEMENT_VOIDVOID(BrowserWindow, TabHandler)
{
    BrowserPanePtr pane;

    // Get the foremost browser pane
    pane = static_cast<BrowserPanePtr>(_tab->GetFront());

    // if successful
    if (pane != null) {

        // move focus to that browser pane
        pane->SetFocusTarget(true);
    }
    return;
}

Tab Browser Sample Code 2

//
// When Soft key 1 or 2 is pressed
//
HANDLER_IMPLEMENT_VOIDEVENT(BrowserWindow, SoftKeyHandler, event)
{
    BrowserPanePtr pane;

    // Get the foremost front browser pane
    pane = static_cast<BrowserPanePtr>(_tab->GetFront());

    // If successful
    if (pane != null) {

        // Release focus from that browser pane
        pane->SetFocusTarget(false);

        // Switch, according to key code
        switch (event.GetP16()) {
            case AVK_SOFT1:

                // Get the next browser pane on the left
                pane = static_cast<BrowserPanePtr>(pane->GetLeft());
                break;
            case AVK_SOFT2:

                // Get the next browser pane on the right
                pane = static_cast<BrowserPanePtr>(pane->GetRight());
                break;
            default:
                break;
        }

        // When there is a new browser pane
        if (pane != null) {

            // Select next browser pane
            pane->Select();
        }
    }

    // Set focus to tab control
    _tab->SetStatusFocus(true);
    return;
}

Tab Browser Sample Code 3

// Constant that stands for pictograms
#define     ICONWORD_CHECKEREDFLAG      0x92F6  // Checker flag
#define     ICONWORD_CHECKMARK          0x73F7  // Check mark
#define     ICONWORD_CAUTIONMARK        0x59F6  // Warning symbol

//
// Constructor
// Invoke parent class constructor and initialize
//
BrowserPane::BrowserPane
    (SFRTabControlPtr control, 
             SFXWideStringConstRef title, SFXWideStringConstRef url)
    : SFRTabPane(control, "")
{
    // If no error in the parent class
    if (static_try()) {

        // Generate browser control
        _browser = ::new BrowserControl(this, GetVirtualWorld());

        // Register left/right arrow keys to handler
        _browser->RegisterHandler
        (SFEVT_KEY, AVK_RIGHT, HANDLER_AFTER, 
                            HANDLER_FUNCTION(NextHandler));
        _browser->RegisterHandler
        (SFEVT_KEY, AVK_LEFT, HANDLER_AFTER, 
                            HANDLER_FUNCTION(PreviousHandler));

        // Display scroll bar of browser control
        _browser->SetScrollbarEnable(true);

        // Invoke URL open function
        Open(title, url);
    }
    return;
}

Tab Browser Sample Code 4

//
// Destructor
// Does nothing
//
BrowserPane::~BrowserPane(Void)
{
    return;
}

Tab Browser Screen Shots

Tab Browser Screen Shot 1 : SFRComboboxControl

Tab Browser Screen Shot 2 : OptionPane