×

Discussion Board

Results 1 to 14 of 14
  1. #1
    Registered User
    Join Date
    Jun 2003
    Posts
    37

    switching views, without using containers

    i've created 2 views, without the usage of containers (i did not inherit CAknView instead i needed CCoeControl).

    MY UI are coded directly in the views.....I know in the standard method i can use switch views in CAknView if i used containers, is there any other way other than thaT?

    I need to switch from view1 to view2 and then back to view1.

    Thanks alot.....
    Last edited by s3ni; 2003-07-21 at 03:15.

  2. #2
    Nokia Developer Expert
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,142
    Hi

    To be fully honest you didn't really got rid of containers, in fact you just got rid of views. And now you are using the containers strait in your UI-class. Basically this was the old style used with 9210, before they invened the view switching in series 60.

    Basically the process of switching containers in your Appui, would be just as you would switch between your containers in your View.

    yucca

  3. #3
    Registered User
    Join Date
    Jun 2003
    Posts
    37
    Oh...I see....

    I tried using

    iAppView = CDictionaryView::NewL(ClientRect());
    AddToStackL(iAppView);

    to return to my 1st view, it this right? the app seems to be a bit buggy when i use this. When i try to exit the app, there was an error "The exception breakpoint...was reach..." then it told me to debug.

    Am i doing it correctly???
    Thanks a lot.

  4. #4
    Nokia Developer Expert
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,142
    Hi

    Look ok, just remember to remove your container from the stack before you delete it.

    yucca

  5. #5
    Registered User
    Join Date
    Jun 2003
    Posts
    37
    Hi yucca,

    In my code I've actually did::
    iAppView = CDictionaryView::NewL(ClientRect());
    AddToStackL(iAppView);

    at the beginning of my code, and after some key events, user will be brought to the second screen::
    iAppView2 = CDictionaryView2::NewL(ClientRect(), wordBuf, &resultBuf);
    iAppView2->SetMopParent(this);
    AddToStackL(iAppView2);

    following that, when user selects "Back" he'll be brought to the first screen again....and what i did is this again::
    iAppView = CDictionaryView::NewL(ClientRect());
    AddToStackL(iAppView);

    I find it a bit weird as i new my view1 twice. Is there any other way, other then this???
    And if i really do this, do i have to remove view1 from the stack TWICE??

    Thanks alot...

  6. #6
    Nokia Developer Expert
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,142
    Hi

    For simplicity, I would only keep one container in the stack, so when ever I would change the container I would take old out of stack and delete it, before adding new to the stack.

    The view thing comes handy there then, to store the data you need to save from the container, even after deleting the container.

    Anyway, for you solution, where you don't delete nor take the container out from stack before starting the second container. You basically need to remember how stack works, so it's just an FiLo-list, which will define which components will get the events. And surely you need to pop anything that you push there, and in reverse order as well.

    Basically you could construct your containers in your AppUi's constructL()-function, and then just add/remove them from stack, depending on which one of them is currently supposed to be in use.

    yucca

  7. #7
    Registered User
    Join Date
    Jun 2003
    Posts
    37
    i see...ok. I get it...I'll give it a try. Thanks alot yucca.

    Btw, another question. How can I enable the "c" (clear) key on the keypad of my emulator?? So that the user will be able to delete characters in the CEikEdwin I created. Did I miss out something on my code????

    I've tried to search through the forum for the solution but couldnt find any.

    Please help...thanks alot :)

  8. #8
    Nokia Developer Expert
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,142
    Hi

    I'm not aware of any problems conserning 'c' button with Edwins, just check that your containers offerkey-function forward all keys to edwin and it should work without any problems.

    yucca

  9. #9
    Registered User
    Join Date
    Jun 2003
    Posts
    37
    hi yucca,

    I already did this inmy container :

    void CDictionaryView::KeyEventL(TInt aCode)
    {
    // Add this 'keypress' to the main output window
    TKeyEvent event;
    event.iCode = aCode;
    event.iScanCode = aCode;
    iEdwin->SetFocus(ETrue);
    iEdwin->OfferKeyEventL(event, EEventKey);
    }

    Did i miss out anything else??
    Thanks alot for your help.

  10. #10
    Registered User
    Join Date
    Jun 2003
    Posts
    37
    hi,

    I've got another question regarding my containers.

    In my appUi, I did this:

    iAppView3 = CDictionaryView3::NewL(ClientRect());
    iAppView3->SetMopParent(this);
    AddToStackL(iAppView3);
    iSocketsEngine->Read(*iAppView3);

    I need to pass in my iAppView3 so that what any printing done in the Read() can be printed on my view3 and not on my previous view. In otherwords, I need this particular view in my Read() so that any printing can be displayed out on the view..

    But I feel that this code seems weird.

    Can you please advice on what I can do...I've been stucked at this problem for days. Thanks alot.
    Last edited by s3ni; 2003-07-23 at 03:20.

  11. #11
    Nokia Developer Expert
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,142
    Hi

    For the keys, you'd be better to use the CCoeControls's offerkey as follows:

    TKeyResponse CDictionaryView::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType)
    {
    return iEdwin->OfferKeyEventL(aKeyEvent, aType);
    }

    Then you could really be sure that all keys are indeed going to your Edwin (At least as long as your container is in stack).

    For the pointer thing, passing a pointer of container would be my first choise as well. But maybe I would construct a Interface for it, so you could work with many containers by just using one pointer in your socket reader.

    yucca

  12. #12
    Registered User
    Join Date
    Jun 2003
    Posts
    37
    hi,

    My clear button is working perfectly fine now....thanks alot =)

    What do you mean by constructing an interface for it?

    When i did:
    iAppView3 = CDictionaryView3::NewL(ClientRect());

    I will be brought from my View1 to my View3..my View3 will be displayed. Following that my sockets will do a Read() from the server...
    iSocketsEngine->Read(*iAppView3);

    and I passed in view3 is so that the results will be displayed in the CEikEdwin I created in View3.

    At my SocketsEngine::Read(MUINotify& iConsole), I did:
    aConsole = iConsole;
    iSocketsRead->Start();

    to transfer the printing to be in view3 instead of the previous view (view1). Is this the right way to do it??

    But it doesnt seems to be working when I did it this way...
    Please advice...Thanks alot

  13. #13
    Registered User
    Join Date
    Jun 2003
    Posts
    37
    Hi,

    How can I without newing the view, but have a pointer to it without displaying it?? And how can I show this view later in my code??

    I tried to declare a pointer:
    CDictionaryView3 iAppView3;

    in my header file. But when I pass in SocketsEngine(*iAppView3) a run time error occured.......how can I make use of *iAppVIew3 pointer without displaying the view out, and how can I get it displayed later in my code??

    Sorry f or so many questions as I am a newbie in Symbian and VC++.....Thanks lot.

  14. #14
    Registered User
    Join Date
    Jun 2003
    Posts
    37
    I've got the thing working :)

    When i new my view3 i dont do ConstructL first and wait till I need to display the view then i proceed with ConstructL()
    =)

    Finally solved the problem!
    Thank you for all your help, yucca

Posting Permissions

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