×

Discussion Board

Results 1 to 13 of 13
  1. #1
    Registered User
    Join Date
    Sep 2008
    Location
    Vancouver, Canada
    Posts
    588

    is it possible to create an application only with containers and no views??

    Hi,

    I am going to create a multiview application. Its going to be a fully custom controls application. Nothing would be from default ui. That is why i was thinking if its possible to skip creating CAknViews from the application. As the CAknView is responsible for handling view specific commands but my app is going to handle commands from the container itself. Its going to be a touch only application. In this case would it be possible to switch views without CAknView in the application? I was trying and got confused at the following:

    To create a screen this is enough:
    Code:
    iContainer = CSplashContainer::NewL(ClientRect());
    but after that we need to add this control to stack to be able to receive commands like this
    Code:
    AddToStackL(iSplashView)
    So screen would be visible and take user commands. But what if i have to switch to another view. In that case, i should remove the current view from the stack right?
    But there is no method to do this if i don't use CAknView in the application. Its possible only if i use CAknView. May be i don't know yet. To switch view it should be something like this
    Code:
    AppUi()->RemoveFromViewStack(*this, iContainer);
    but here pointer this should be a CAknView and not a CCoeControl!

    Can i do without CAknViews and still able to remove CCoeControls from the stack??

    Please suggest.

  2. #2
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,166

    Re: is it possible to create an application only with containers and no views??

    I actually stopped using Views right after they were introduced with S60, so you could indeed use the good old way, and handle Commands in your AppUI command handling, and us CCoeControl based containers directly in AppUI class.

    just remember to change the base class for AppUI class, otherwise you'll end up having some visibility issues with command buttons.

  3. #3
    Registered User
    Join Date
    Sep 2008
    Location
    Vancouver, Canada
    Posts
    588

    Re: is it possible to create an application only with containers and no views??

    Ok but how do i switch between screens? Is control stack not required in this case? I might have to switch to another screen from the current screen. I should delete the current one and create the second one. But what about control stack??

  4. #4
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,166

    Re: is it possible to create an application only with containers and no views??

    in general, you would add the CCoeControl based container to the stack with AddToStackL, and then when setting another one there, you would use RemoveFromStack to remove the previous. note that it is stack indeed, and you do need to remember what was added last so you know what's coming out.

    Deleting would be an option, it would make it easier to handle the adding/removing from the stack, since you would only have one valid view, and it would be the only one in the stack at any time.

  5. #5
    Registered User
    Join Date
    Sep 2008
    Location
    Vancouver, Canada
    Posts
    588

    Re: is it possible to create an application only with containers and no views??

    Ok i tried and found that AddToStackL and RemoveFromStack isn't working. App crashes with Kern-Exec 3 when removing the old CCoeControl from stack. I think simple deletion and creation of CCoeControls is easy to go with.

  6. #6
    Registered User
    Join Date
    Sep 2008
    Location
    Vancouver, Canada
    Posts
    588

    Re: is it possible to create an application only with containers and no views??

    Following is not working from the current CCoeControl
    Code:
    			iAppUi->RemoveFromStack(this);
    			iLoginView = CLoginContainer::NewL(CEikonEnv::Static()->EikAppUi()->ApplicationRect());
    			iAppUi->AddToStackL(iLoginView);
    Also if i try to simple delete the current CCoeControl and create sencond, it gives CONE 44 panic (control still on stack)
    Code:
    			delete this;
    			iLoginView = CLoginContainer::NewL(CEikonEnv::Static()->EikAppUi()->ApplicationRect());
    Am i not using them correctly??

  7. #7
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,166

    Re: is it possible to create an application only with containers and no views??

    what excatly are you thinking on doing with iAppUi->RemoveFromStack(this); line ? or delete this; ?

    Basically you only need to care on deleting the container-views you are have created, as well as only remove stuff from the stack you have pushed in.

  8. #8
    Registered User
    Join Date
    Sep 2008
    Location
    Vancouver, Canada
    Posts
    588

    Re: is it possible to create an application only with containers and no views??

    with iAppUi->RemoveFromStack(this);, I am trying to remove the container that i previously added to the stack and then creating the new container and adding it to stack.

    same thing with delete this; - trying to delete this container and creating new one.

    Simple creation of container-view whenever switching is required is working though.

  9. #9
    Registered User
    Join Date
    Sep 2008
    Location
    Vancouver, Canada
    Posts
    588

    Re: is it possible to create an application only with containers and no views??

    Even though i got it working with deletion but just wanted to know how to make it working with methods AddToStackL and RemoveFromStack.

    Is the way i am using these wrong?

  10. #10
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,696

    Re: is it possible to create an application only with containers and no views??

    AddToStackL and RemoveFromStack are very good methods. However deleting an object, and assigning a value to one of its members in the next line is just a general C++ problem. Leading to KERN-EXEC 3 in Symbian, especially if you do it in the debugger.
    Generally you want to store the next view in an existing object, like AppUi, and not in a deleted one. This entire code snippet could have a better place in the AppUi (RemoveFromStack(iSomething);iLoginView=CLoginContainer::NewL(ApplicationRect());AddToStackL(iLoginView) when in a piece of code every line refers to a single other object (like AppUi and its methods, like RemoveFromStackL, ApplicationRect, AddToStackL), that code rather belongs to that other object.

  11. #11
    Registered User
    Join Date
    Sep 2008
    Location
    Vancouver, Canada
    Posts
    588

    Re: is it possible to create an application only with containers and no views??

    This entire code snippet could have a better place in the AppUi (RemoveFromStack(iSomething);iLoginView=CLoginContainer::NewL(ApplicationRect());AddToStackL(iLoginView)
    But i have to switch view from another view. Can this not work in another CCoeControl? Also, i am taking reference of AppUi, so its being done on existing object and not on deleted object.
    I am creating the first container-view in the AppUi and then switching to another container-view from the one created in AppUi. I guess that is fine.

    Refering to #6, this code in second container-view. But there its throwing kern-exec 3.
    AddToStackL is fine but i can't find the correct place for RemoveFromStack and that is crashing the app.

  12. #12
    Registered User
    Join Date
    Sep 2008
    Location
    Vancouver, Canada
    Posts
    588

    Re: is it possible to create an application only with containers and no views??

    Actually second container-view was still on stack. Removing it in destructor fixed the issue. Done

  13. #13
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,696

    Re: is it possible to create an application only with containers and no views??

    Quote Originally Posted by raj8nokiaforum View Post
    But i have to switch view from another view. Can this not work in another CCoeControl?
    Oh, there are a lot many coding styles which work, than the ones considered being correct. Obviously if you put the view switching mechanism to the AppUi, you can call it from a CCoeControl, as you already did with AddToStackL, etc. But that would be 1 call, and not 3.
    Also, i am taking reference of AppUi, so its being done on existing object and not on deleted object.
    I was talking about the
    Code:
    delete this;
    iLoginView = ...
    part. iLoginView is a member variable in the current object. And the current object has been destroyed in the previous line. I hope you feel why it is not correct.
    I am creating the first container-view in the AppUi and then switching to another container-view from the one created in AppUi. I guess that is fine.
    Switching the view is fine. Storing the pointer of the new view in a non-existing object is not.
    Refering to #6, this code in second container-view. But there its throwing kern-exec 3.
    Indeed, that makes two of us. I am also talking about #6.

Similar Threads

  1. Views, Containers, changing between them.
    By szeldon in forum Symbian User Interface
    Replies: 2
    Last Post: 2008-01-01, 17:12
  2. Views, containers and dialogs
    By _fox in forum Symbian
    Replies: 5
    Last Post: 2004-06-25, 04:31
  3. Views, containers and dialogs
    By _fox in forum Symbian User Interface
    Replies: 0
    Last Post: 2004-06-21, 11:37
  4. switching views, without using containers
    By alokkumarsingh in forum Symbian User Interface
    Replies: 2
    Last Post: 2004-06-07, 09:03
  5. switching views, without using containers
    By s3ni in forum Symbian User Interface
    Replies: 13
    Last Post: 2003-07-23, 05:17

Posting Permissions

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