Dyanamic loading of Commands..????????????

Login to reply to this topic.
Thu, 2008-01-31 10:47
Joined: 2008-01-29
Forum posts: 18

I am developing one UIQ3 multi view application in which each page has got some different commands , so i want to add this commands dynamically, like when i click any tab then commands related to that tab should be loaded on to that page.. Can any one help me out ???thanks....


Thu, 2008-01-31 13:09
Joined: 2005-11-20
Forum posts: 1241
Re: Dyanamic loading of Commands..?

You mean you have multiple views, and multiple pages on some of them, and want command not only per-view, but per-page?

If yes I would define all the commands for each view as usual, in the resource file, and then work with CQikCommandManager::Static() and CQikCommandManager::SetInvisible.

This looks like a good introduction to the topic and has a chapter at the end which shows fully dynamic commands created and deleted at runtime, if something as dynamic as this should be necessary:
http://books.uiq.com/index.php/Commands_and_categories

BTW, all those question marks hurt the eyes ... one would have been enough, really Smiling


René Brunner

Thu, 2008-01-31 14:32
Joined: 2008-01-29
Forum posts: 18
Re: Dyanamic loading of Commands..????????????

Next time i will put only one ? Smiling ..I know we can use CQikCommandManager::SetInvisible...but now my problem is that how do i recognize whether particular tab has been clicked or not?? there is on method TabactivatedL()..but it's not solving my prob.
I did this..
void CListBoxListView::TabActivatedL(TInt aTabId)
{
CQikCommandManager& iCommandManager = CQikCommandManager::Static();
aTabId=ActivePageId();
if(aTabId==EAppSpecificListViewPageId1)
iCommandManager.SetDimmed(*this, EBROWSE, ETrue);
else
{
iCommandManager.SetDimmed(*this, EBROWSE, ETrue);
ActivatePageL(EListBoxListViewPage);
}


}

Thu, 2008-01-31 14:54
Joined: 2005-11-20
Forum posts: 1241
Re: Dyanamic loading of Commands..?

I think this line is not needed because the parameter has already the correct value, the id of the tab to activate:

aTabId=ActivePageId();

And why did you write ETrue *two times* in both calls to SetDimmed, in the if branch as well as in the else branch? Somehow that does not look right.


René Brunner

Thu, 2008-01-31 15:29
Joined: 2008-01-29
Forum posts: 18
Re: Dyanamic loading of Commands..?

Sorry that ETrue was by mistake.But that code is not working..

void CListBoxListView::TabActivatedL(TInt aTabId)
{ CQikCommandManager& iCommandManager = CQikCommandManager::Static();

if(aTabId== EAppSpecificListViewPageId1)
{

iCommandManager.SetDimmed(*this, EBROWSE, ETrue);
// ActivatePageL(EAppSpecificListViewPageId1);
}
else if(aTabId== EListBoxListViewPage)
{
iCommandManager.SetDimmed(*this, EBROWSE, EFalse);
ActivatePageL(EListBoxListViewPage);

}


}

where EAppSpecificListViewPageId1 and EListBoxListViewPage are defined in .hrh file..But in this code both if conditions are getting false..why ? thanks..

Thu, 2008-01-31 15:33
Joined: 2008-01-29
Forum posts: 18
Re: Dyanamic loading of Commands.?

Now i am getting KERN-EXEC 3? thanks.

Thu, 2008-01-31 15:41
Joined: 2008-01-29
Forum posts: 18
Re: Dyanamic loading of Commands..????????????

i know i am troubling you rbrunner , but i can not help it.. i am very much new to this platform and i wanna learn a lot... Smiling

Thu, 2008-01-31 19:42
Joined: 2005-11-20
Forum posts: 1241
Re: Dyanamic loading of Commands..?

In such cases, I have an advice: Debug the thing.

If you do not yet know how to debug, and maybe also think that this topic is a little scary, I can just tell you: Maybe it's hard in the beginning, until you know your way around within the debugger, but in my experience it's just plain impossible to develop a non-trivial Symbian program without the help of the emulator and the debugger.

The debugger would show you the exact point in your program where the exception occurs, and you could put a breakpoint at the start of TabActivatedL to see yourself what value the OS passes you as aTabId.

By the way, I just saw in the UIQ book chapter that I gave a link to this morning explains that UIQ3 already supports page-specific command. Just search for the heading "Page specific commands".


René Brunner

Fri, 2008-02-01 05:51
Joined: 2008-01-29
Forum posts: 18
Re: Dyanamic loading of Commands..?

Ya i know it Page specific commands..for that we need to handle it through resource file.i already did it..But i don't wanna do in that manner.I want only one command list and from that command list i wanna load page specific commands.As pages have some common command..thanks..

Fri, 2008-02-01 06:17
Joined: 2008-01-29
Forum posts: 18
Re: Dyanamic loading of Commands..????????????

My problem is solved rbrunner.. Smiling Thanks ...

Fri, 2008-02-01 08:31
Joined: 2008-01-29
Forum posts: 18
Re: Dyanamic loading of Commands..?

Hi rbrunner, now i have new query...I am using EEikCmdExit command for closing my application..previously i was using EQikCmdFlagDebugOnly flag in resource file. as name EQikCmdFlagDebugOnly suggest that command will visible only in debug mode, not on device. But main advantage of EEikCmdExit which is present in uicon.hrh is that you don't need to handle application's termination , framework handles it.. so what can i do if i still wanna use EEikCmdExit and it should be visible on device..thanks..

Fri, 2008-02-01 10:17
Joined: 2005-11-20
Forum posts: 1241
Re: Dyanamic loading of Commands..?

You don't have to use EEikCmdExit, you can defiine any command you want and just react with calling CQikAppUi.:Exit() to it, and your program will terminate properly.


René Brunner

Thu, 2008-02-07 07:52
Joined: 2008-01-29
Forum posts: 18
Re: Dyanamic loading of Commands..?

Hi rbrunner this is amit once again..That day you told me to call Exit().I have called it in HandleCommandL() of each view..Its working fine with emulator , as when i call Exit() , it calls destructor of my UI class and application terminates safely. But when i tried it on device, the scene was completely different.I have on device debugging facility, when i have debugged my code ,that Exit Function was not calling destructor of UI class.So there is memory leakage.Can you suggest me any other way to rectify this problem?Thanks.

Thu, 2008-02-07 08:52
Joined: 2005-11-20
Forum posts: 1241
Re: Dyanamic loading of Commands..?

I am not sure, but I would say: Don't worry.

First, you don't have to worry about memory leaks if a program terminates. If a program terminates, in whichever way, by calling Exit(), or by panic, or by crash, the Symbian OS always releases all memory that was allocated by the program. It has to, there is no other way, after all, if a program crashes it won't free its allocations itself, right?

Memory leaks are only dangerous if your program produces them *and* continues to run.

I don't know why you don't see the destructor of the AppUI class called in the on-device debugger. It might be called, but the debugger is not able to catch the call. It might not be called, but that may be ok and intended by the designers of UIQ. But as I said, I personally would not worry about this, because memory will be freed anyway after your program terminated.


René Brunner

  • Login to reply to this topic.