GlobalNote problem (newbie here)
| Tue, 2007-07-17 17:25 | |
|
Hi All, Intro: Question: TBool CCastContainerView::HandleItem1MenuItemSelectedL( TInt aCommand )I think I understand that I have to write the code, between the brackets {} , that will pop up my global note. In the UIdesign I have added the Global Note (Pallete -> Notes and Dialogs -> Global Note). After adding the Global Note I have noticed that the following code appears in the code section for use: void CCastContainerView::RunGlobalNote1L( const TDesC* aOverrideText )But how do I use this piece of code to run the Global Note when I have pushed Item1 in the option menu? Outro: Devoney |
|






Forum posts: 27
Hi, I'm not sure that I understand your query.
The function HandleItem1MenuItemSelectedL should be called by HandleCommandL function in your Appui. However as i don't see any obvious benefit to calling HandleItem1MenuItemSelectedL
The function header for RunGlobalNote1L should look like
void CCastContainerView::RunGlobalNote1L( const TDesC& aOverrideText ) in oder to comply with symbian conventions
and the line globalNote->ShowNoteL( EAknGlobalErrorNote, *aOverrideText ); should be changed to globalNote->ShowNoteL( EAknGlobalErrorNote, aOverrideText );
You call RunGlobalNote1L in your HandleCommandL with some simple code like:
_LIT(KText,"Hello");
RunGlobalNote1L (KText);
Does this answer your question?
Forum posts: 8
Thanks for your quick help. Micarulous the function works by only calling RunGlobalNote1L (and I swear I tried that). But now I have a problem with the text to appear. What you gave me trows an error. I will try to figure it out.
Forum posts: 8
Sorry for double post, can I edit a reply?
Why do I have to change * to & as you instructed me to do. The works without changing.
When the variable aOverrideText is specified (so it is not NULL) it uses the contents of aOverrideText instead of the text specified in UIdesigner (which is "Error").
As you can see in this code:
if ( aOverrideText == NULL ){
HBufC* noteText = StringLoader::LoadLC( R_CAST_CONTAINER_GLOBAL_NOTE1 );
globalNote->ShowNoteL( EAknGlobalErrorNote, *noteText );
CleanupStack::PopAndDestroy( noteText );
}
else
{
globalNote->ShowNoteL( EAknGlobalErrorNote, *aOverrideText );
}
CleanupStack::PopAndDestroy( globalNote );
}
I am figuring out how to specify aOverrideText. I have no experience with C++. I do with Assembler in Windows and Visual Basic and PHP so I still have to learn the syntax of C++.
Where can I find all the APIs that can be used in a Symbian OS application? Thanks.
Devoney
Forum posts: 27
Hi,
I suggested to change the * to & as symbian os guidelines specify that if you dont need to edit a variable you should do so. Anyhow its not so important.
Why don't you keep your function simple for the moment. and specify the function header (in your .h file) as
void RunGlobalNote1L( );
and implementation (in your .cpp file) as
void CCastContainerView::RunGlobalNote1L( )
{
_LIT(KText,"Global Note Text");
CAknGlobalNote* globalNote = CAknGlobalNote::NewLC();
globalNote->ShowNoteL( EAknGlobalErrorNote, KText);
CleanupStack::PopAndDestroy( globalNote );
}
String handling is one of the more difficult concepts to understand in Symbian even if you come from a C++ background!
In order to get started you should look through the examples in the SDK and forums such as this one.
A book that I cannot recommend enough is Symbian OS explained by Jo Stichbury. It explains all of the basic types and concepts. Beforehand it may be worth familiarising yourself with some of the basic c++ stuff such as pointers, references etc.
Forum posts: 8
Thanks very much for your help. I feel like I have made a start (at last).
I am following the tutorial from www.cplusplus.com
I have searched for a Symbian programming guide or some sort in our biggest book dealer (www.bol.com) but all the books are over 50 euros (which is I think 60 dollars) Maybe I can find a good alternative on the internet.
By the way. I also have an options menu can I also kill that by using
CleanupStack::PopAndDestroy( optionsMenu );
Thanks again!
Forum posts: 27
Hi Devoney,
You cannot kill your options menu using CleanupStack::PopAndDestroy( optionsMenu );. CleanupStack is Symbian OS's replacement for normal c++ try catch statements which you will read about.
The book i recommended about is available for roughly €40 on Amazon.
Brian
Forum posts: 8
I have searched for a .h file like you said. I have found
#include <aknglobalnote.h>Is this wat you mean? So when I change it in their will this function always be changed on whatever project I am working?