×

Discussion Board

Page 1 of 3 123 LastLast
Results 1 to 15 of 39
  1. #1
    Regular Contributor
    Join Date
    Apr 2008
    Posts
    112

    [moved] changing label of global note

    how can i change the label of globalnote from "hiii" to say "bye"
    after sometime.

    CAknGlobalNote* iNote = CAknGlobalNote::NewLC();
    iNote->SetPriority(EPriorityLow);
    iNote->SetSoftkeys(R_AVKON_SOFTKEYS_CALL_CANCEL);
    theStat = KRequestPending;

    TInt iNoteId = iNote->ShowNoteL( theStat,EAknGlobalTextNote, _L("hiiiii") );


    User::WaitForRequest(theStat);

    CleanupStack::PopAndDestroy( iNote );


    // TBool answer = (iNoteId == EAknSoftkeyCall);

    if(theStat.Int()==EAknSoftkeyCall)
    {
    CAknGlobalNote* globalNote1 = CAknGlobalNote::NewLC();
    globalNote1->ShowNoteL( EAknGlobalTextNote, _L("Answer") );
    CleanupStack::PopAndDestroy( globalNote1 );
    }else
    {
    CAknGlobalNote* globalNote2 = CAknGlobalNote::NewLC();
    globalNote2->ShowNoteL( EAknGlobalTextNote, _L("Hangup") );
    CleanupStack::PopAndDestroy( globalNote2 );

    }
    thank u

  2. #2
    Nokia Developer Champion
    Join Date
    Oct 2006
    Location
    Bangalore, India
    Posts
    1,572

    Re: changing label of global note

    I am not sure about how to do that !!!
    but I guess one option is to kill this note and start another note, it will be fast enough and will do the purpose...
    Amit Kankani
    Nokia Developer Champion

  3. #3
    Regular Contributor
    Join Date
    Apr 2008
    Posts
    112

    Re: changing label of global note

    Quote Originally Posted by amitkankani View Post
    I am not sure about how to do that !!!
    but I guess one option is to kill this note and start another note, it will be fast enough and will do the purpose...
    how we can kill a note
    control is waitng for the event i.e softkey click
    so how we can close after 5 mins.
    thank u

  4. #4
    Regular Contributor
    Join Date
    Feb 2007
    Location
    Mumbai
    Posts
    67

    Re: changing label of global note

    Hi,

    U can kill a note using CancelNoteL as follows:

    CAknGlobalNote* aGlobalNote = CAknGlobalNote::NewLC();
    NoteId = ShowNoteL(EAknGlobalInformationNote,KMessage);
    User::After(2000000);//after 2secs
    aGlobalNote->CancelNoteL(NoteId);
    CleanupStack::PopAndDestroy(aGlobalNote);


    Regards,

    Sunil

  5. #5
    Regular Contributor
    Join Date
    Apr 2008
    Posts
    112

    Re: changing label of global note

    Quote Originally Posted by sunil.shetty View Post
    Hi,

    U can kill a note using CancelNoteL as follows:

    CAknGlobalNote* aGlobalNote = CAknGlobalNote::NewLC();
    NoteId = ShowNoteL(EAknGlobalInformationNote,KMessage);
    User::After(2000000);//after 2secs
    aGlobalNote->CancelNoteL(NoteId);
    CleanupStack::PopAndDestroy(aGlobalNote);


    Regards,

    Sunil
    but i have to handle call and cancel button
    so i use trequest to get the response
    so wht i need is my global note has to wait for a sometime for response ,if it not get the response then i have to change the label.
    thank u
    arumilli
    Last edited by arumilli; 2008-06-13 at 06:13.

  6. #6
    Nokia Developer Champion
    Join Date
    Oct 2006
    Location
    Bangalore, India
    Posts
    1,572

    Re: changing label of global note

    exactly...

    put the note and then start a periodic object of the duration you want to wait. If before this period, the user hits the key, RunL of your active object will be called and you can cancel the Periodic, else if the periodic is called before, then calcel the note and show the new note ...

    only thing is that you will need to have the active object to do this !
    Amit Kankani
    Nokia Developer Champion

  7. #7
    Regular Contributor
    Join Date
    Apr 2008
    Posts
    112

    Re: changing label of global note

    Quote Originally Posted by amitkankani View Post
    exactly...

    put the note and then start a periodic object of the duration you want to wait. If before this period, the user hits the key, RunL of your active object will be called and you can cancel the Periodic, else if the periodic is called before, then calcel the note and show the new note ...

    only thing is that you will need to have the active object to do this !
    thank u
    can u show me some code.

  8. #8
    Nokia Developer Champion
    Join Date
    Oct 2006
    Location
    Bangalore, India
    Posts
    1,572

    Re: changing label of global note

    well may be i wouldn't type the entire code due to time constraints, but I could help you out with classes to use !!!

    * Make you class derive from CActive.
    * see CPeriodic class for the periodic object to be created.
    * You note issueing would be somthing like this:
    delete iPerioric;
    iPerioric = NULL;
    iPerioric = CPeriodic::NewL();
    iPerioric->Start(duration, duration, TCallback(StaticPeriodicFunction,this));
    TInt iNoteId = iNote->ShowNoteL( theStat,EAknGlobalTextNote, _L("hiiiii") );
    SetActive();
    and when the user selects one of the keys, ::RunL would be called with appropriate status id.

    Now due to periodic, the StaticPeriodicFunction will be called and due to user key press RunL will be called.

    So which ever happens early, can cancel the other, and proceed with the logic.

    Hope these indications will hint you to write the code yourself, (see active objects and CPeriodic examples from SDK as well)
    Amit Kankani
    Nokia Developer Champion

  9. #9
    Regular Contributor
    Join Date
    Apr 2008
    Posts
    112

    Re: changing label of global note

    i tried the following code
    iNote = CAknGlobalNote::NewLC();
    iNote->SetPriority(EPriorityLow);
    iNote->SetSoftkeys(R_AVKON_SOFTKEYS_CALL_CANCEL);
    theStat = KRequestPending;

    iNoteId = iNote->ShowNoteL( theStat,EAknGlobalTextNote, _L("Calling") );



    iPeriodicTimer->Start(
    KPeriodicTimerInterval5Sec, KPeriodicTimerInterval5Sec,
    TCallBack(PeriodicTimerCallBack, this));
    User::WaitForRequest(theStat);






    if(theStat.Int()==EAknSoftkeyCall)
    {
    CAknGlobalNote* globalNote1 = CAknGlobalNote::NewLC();
    globalNote1->ShowNoteL( EAknGlobalTextNote, _L("Answer") );
    CleanupStack::PopAndDestroy( globalNote1 );
    }else
    {
    CAknGlobalNote* globalNote2 = CAknGlobalNote::NewLC();
    globalNote2->ShowNoteL( EAknGlobalTextNote, _L("Hangup") );
    CleanupStack::PopAndDestroy( globalNote2 );

    }



    CALLBACK FUNTION
    TInt CAknExNoteContainer:: PeriodicTimerCallBack(TAny* aAny)
    {
    CAknExNoteContainer* self = static_cast<CAknExNoteContainer*>( aAny );

    self->SomeFuntion();
    return KErrNone;
    }


    void CAknExNoteContainer::SomeFunction()
    {

    iNote->CancelNoteL(iNoteId);
    CleanupStack::PopAndDestroy( iNote );
    }

    bu my globalnote is still there.
    how can i destory globalnote
    thank u
    Last edited by arumilli; 2008-06-14 at 05:57.

  10. #10
    Nokia Developer Champion
    Join Date
    Oct 2006
    Location
    Bangalore, India
    Posts
    1,572

    Re: changing label of global note

    Hi, nice attempt, some things which should be further changed are mentioned in the code below:

    1. First of all derive this class from CActive, then follow these:

    2. see the changes in the code below (i haven't compiled it, so correct any compiler errors, other wise logic is fine)
    void CAknExNoteContainer::ShowNoteL()
    {
    iNote = CAknGlobalNote::NewLC();
    iNote->SetPriority(EPriorityLow);
    iNote->SetSoftkeys(R_AVKON_SOFTKEYS_CALL_CANCEL);

    iNoteId = iNote->ShowNoteL( iStatus, EAknGlobalTextNote, _L("Calling") );
    SetActive(); // set this as active

    iPeriodicTimer->Start(
    KPeriodicTimerInterval5Sec, KPeriodicTimerInterval5Sec,
    TCallBack(PeriodicTimerCallBack, this));
    // User::WaitForRequest(theStat); - no need to do this now as Active Schedular will call RunL once user presses a key
    }


    void CAknExNoteContainer::RunL()
    {
    // if it comes here, it means that user has pressed key before my timer expired
    // so first thing to do here is to cancel my timer, as it is no longer required
    iPeriodicTimer->Cancel();

    if(iStatus.Int()==EAknSoftkeyCall)
    {
    CAknGlobalNote* globalNote1 = CAknGlobalNote::NewLC();
    globalNote1->ShowNoteL( EAknGlobalTextNote, _L("Answer") );
    CleanupStack::PopAndDestroy( globalNote1 );
    }else
    {
    CAknGlobalNote* globalNote2 = CAknGlobalNote::NewLC();
    globalNote2->ShowNoteL( EAknGlobalTextNote, _L("Hangup") );
    CleanupStack::PopAndDestroy( globalNote2 );
    }
    }

    void CAknExNoteContainer::DoCancel()
    {
    iNote->CancelNoteL(iNoteId); // cancel my note here
    }


    CALLBACK FUNTION
    TInt CAknExNoteContainer:: PeriodicTimerCallBack(TAny* aAny)
    {
    CAknExNoteContainer* self = static_cast<CAknExNoteContainer*>( aAny );
    self->SomeFuntion();
    return KErrNone;
    }


    void CAknExNoteContainer::SomeFunction()
    {
    // IF it comes here, it means that the timer has expired and user has yet not pressed any of the soft-keys
    // so first thing to do is cancel my active request
    Cancel(); // this will call DoCancel (we should not call DoCancel explicitly)
    // CleanupStack::PopAndDestroy( iNote ); // NEVER EVER push and pop MEMBER VARIABLES, instead follow simple steps of delete, assign null, assign memory every where and in destructor just delete.
    }

    I have also seen that you are pushing member variables on to CleanupStack, never do this. Instead follow simple steps of delete, assign null, assign memory every time and in destructor just delete that member variable.

    hope this helps :)
    Amit Kankani
    Nokia Developer Champion

  11. #11
    Regular Contributor
    Join Date
    Apr 2008
    Posts
    112

    Re: changing label of global note

    thank u
    but my application was closing at SetActive()
    whether i have to include any files or libs??
    iam getting the following information dialog
    Application close
    NOTE
    E32USER-CBASE49
    Last edited by arumilli; 2008-06-16 at 07:04.

  12. #12
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,675

    Re: changing label of global note

    What about reading the SDK Help? Search for E32USER-CBase 49 in it.

  13. #13
    Regular Contributor
    Join Date
    Apr 2008
    Posts
    112

    Re: changing label of global note

    thanku
    i found this inSDK
    This panic is raised by the SetActive() and Deque() member functions of an active object, a CActive. It is raised if the active object has not been added to the active scheduler.
    so how can iadd active object to active scheduler

  14. #14
    Regular Contributor
    Join Date
    Apr 2008
    Posts
    112

    Re: changing label of global note

    i tried this
    CActiveScheduler::Add(this);
    now i error number change to 46 i.e
    E32USER-CBASE49

  15. #15
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,675

    Re: changing label of global note

    Make sure that you have removed the User::After/User::WaitForRequest calls from your code. Also make sure that you use iStatus (and not some local variable) as TRequestStatus.

Similar Threads

  1. GoogleIt
    By deepika.mangla in forum Symbian
    Replies: 5
    Last Post: 2011-05-28, 11:04
  2. How to know if global note is displayed or not
    By mfarooqkhan78 in forum Symbian User Interface
    Replies: 1
    Last Post: 2008-07-30, 12:48
  3. Error while making sis file
    By lalitjadiya in forum Symbian
    Replies: 9
    Last Post: 2008-05-20, 17:18
  4. need information about j2me polish
    By rathikathangaraj in forum Mobile Java General
    Replies: 4
    Last Post: 2007-12-19, 09:01

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×