Dyanamic loading of Commands..????????????
| Thu, 2008-01-31 10:47 | |
|
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.... |
|






Forum posts: 1241
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
René Brunner
Forum posts: 18
Next time i will put only one ?
..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);
}
}
Forum posts: 1241
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
Forum posts: 18
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..
Forum posts: 18
Now i am getting KERN-EXEC 3? thanks.
Forum posts: 18
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...
Forum posts: 1241
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
Forum posts: 18
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..
Forum posts: 18
My problem is solved rbrunner..
Thanks ...
Forum posts: 18
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..
Forum posts: 1241
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
Forum posts: 18
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.
Forum posts: 1241
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