Join Now

Switching Avkon Views

Carbider | 31 October, 2007 13:20

All of the views in my application which is shown here are represented as “Setting Item List” components (classes). Even main screen does. Here I reported vagueness about how to switch from one view (screen) to another. For example as I pick a “PAN” setting from main option menu I should be redirected to new PAN settings screen.

                   

Now I can tell you how it can be done.

                 

The way to this was laid through “MultiViews” S60 SDK example. It is found at “S60_3rd_FP1 / S60Ex / MultiViews” folder. I was solving the rebuses and found out that the final switching comes through AppUi()->ActivateLocalViewL() call. This function takes TUid parameter which is a View’s Identifier.

The accordance between the View and it’s ID is defined as Enumeration at [projectName].hrh file like this:

Listing 1:

enum TguiSetBluspanViewUids

{

               EGuiSetBluspanSettingItemListViewId = 1,

               EGuiSetBluspanSettingItemList2SettingsPanViewId,

               EGuiSetBluspanSettingItemList2SettingsZeroconfViewId,

               EGuiSetBluspanSettingItemList2SettingsUserViewId

            

};

So I assigned the Handler function to PAN menu-item click and implemented code:

AppUi()->ActivateLocalViewL(TUid::Uid(EGuiSetBluspanSettingItemList2SettingsPanViewId ) );

Yeah, this name is true long but was generated automatically.

    

 

Diagram 01 – Switch from main screen to PAN settings screen.

As I implemented analogous code for the rest Views at Settings submenu (diagram 2)

I discovered that the new child view has Exit soft button which will exit the application if was clicked. But I need it to return back to the main screen not exit.

Diagram 02 – Settings submenu

 

At properties menu I picked OPTIONS_BACK instead of OPTIONS_EXIT (diagram 3).

                 

 

Diagram 03 – Options menu properties

 

But it did not cause the required effect. The button’s name was changed but it still executed Exit function. The reason is the following block of code, situated at HandleCommandL( TInt aCommand ) function:

Listing 2:

// [[[ begin generated region: do not modify [Generated Code]

if ( aCommand == EAknSoftkeyBack )

{

AppUi()->HandleCommandL( EEikCmdExit );

}

// ]]] end generated region [Generated Code]

 

I changed the code above to this one:

 

Listing 3:

if ( aCommand == EAknSoftkeyBack )

{

AppUi()->ActivateLocalViewL( TUid::Uid( EGuiSetBluspanSettingItemListViewId ) );

// The ID is in the [projectName].hrh file too

}

So, I’ve activated the Main screen (view) by this call. It works well but there is a problem: the code is situated in the middle of following framework:

// [[[ begin generated region: do not modify [Generated Code]

// ]]] end generated region [Generated Code]

It means that after any change to given View (with help of UI designer) my code would be rewritten with those one that’s shown at listing 2. That are not good news and I didn’t find more appropriate decision yet.

The last version of BluSPAN GUI source code can be found over this Zip Archive here.

 

Extract files from it, than create new workspace and import Bld.inf file as was shown at previous posts here.

 

 

Konstantine Voytenko

 

 
 
Powered by LifeType