×

Discussion Board

Results 1 to 9 of 9
  1. #1
    Registered User
    Join Date
    Jul 2004
    Posts
    43

    UI/Container interaction

    My app has one AppUI, V1, that owns a container C1. V1 also has a method called controller.

    On Application start, V1 instantiates C1 and runs it (?). After which I want the control/code flow to come to controller.

    Basically I have a container called splash screen (C1) and a container called menu (C2).

    I want the AppUI to display the splash, run a timer and then delete splash and instantiate my menu.

    In length that would be

    new C1
    addtostack C1
    waitfor 3 secs
    removefrom stack C1
    delete C1

    new C2
    addtostack
    .
    .
    .
    .
    And so on ...
    Last edited by Sukrit; 2004-08-12 at 12:38.

  2. #2
    Registered User
    Join Date
    Jul 2004
    Posts
    43
    Further I would like to add this.

    After the AppUI is constructed, I simply don't know where the code flow goes.

    What I looking for, maybe, is that once the application starts the AppUI is constructed and it has an event handler that gets a application_start_event where I can easily call controller-method or any method. What I don't know is how actually this can be done!

    Thanks for your patience.
    Last edited by Sukrit; 2004-08-12 at 12:28.

  3. #3
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,166
    have a look into a timeout timer implementation (for example in animation example) and use it for timing the splash.

    So construct the splash start timer and in timers call back switch the containers.

    yucca

  4. #4
    Registered User
    Join Date
    Jul 2004
    Posts
    43
    I had a look but didn't find what I was looking for. In fact timers aren't the issue.

    Switching between containers is.

    Essentially I want to have the codeflow come to AppUI::controller() somehow.

    I thought that I would have an event "start-app" generated from my AppUI's constructor and "start-app" would call AppUI::Controller() which could do everything I want to be doing. Is that possible? What API's Should I use?

    Basically, after a AppUI has be instantiated, where does the code flow go till any event is generated. Is there a defualt first event that is generated everytime an application starts up?

    should I do this in AppUi::HandleForegroundEventL()?

    Super Confused!

  5. #5
    Registered User
    Join Date
    Jul 2004
    Posts
    43
    I have been trying to frame this question for long and failing. I hope this describes my problem better. It's basically about designing applications and such, I think.

    class Menu: public CCoeControl {
    ...
    public:
    Draw();
    offerkeyevents()//This handles events and calls updates display methods, also it sets variables in AppUI

    ...}

    class Splash: public CCoeControl{
    ...
    public:
    Draw()//Draws a bitmap on screen
    MyTimerL();//Runs a timer for 3secs
    OfferKeyEvents();
    ...}

    class AppUIublic CEikAppUI{
    public:
    TInt8 iGameState;//State Variable
    ConstructL()//Instantiates Splash container.
    HandleCommand();//Only handling Exit here

    }

    I don't want to instantiate both objects in ConstructL of AppUI. How do I manage my Menu and Splash from AppUI? Is it even the recommended way - Managing containers from AppUI (the design idea came naturally to me and I don't know abotu MVC). If not how else can i model my application, without losing all my hair?
    Last edited by Sukrit; 2004-08-13 at 05:34.

  6. #6
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,166
    if you don't know about MCV, then it is better not to care too much about it and handle everything as you feel best.

    Anyway, I think you would be better off if you would read the first post again, since it works completely nicely. Basically in your AppUi constructL you just construct the splash add it to the stak and start the times. Then the system will nicely draw the splash and the timer will be in bakground counting its expiry time.

    Meanwhile all menu commands will be handled by your AppUi command handler and keys will go to the splash container (since it is in the stack and the most upper one)

    Then when your timer expires you take the splash out from the stack delete the splash (set the pointer to it to NULL also), construct your app container and add it to the stack.

    Now the menu commands are still going to the AppUi command handler and keys will now go to the new container.

    yucca

  7. #7
    Registered User
    Join Date
    Jul 2004
    Posts
    43
    Hardly nicely. Nothing is drawn What am I doing wrong?

    Something undesired is happening. The system blocks on WaitForRequest and nothing is drawn on the screen!!!

    void CAppUi::ConstructL(){
    BaseConstructL();
    iSplashContainer = CSplashContainer::NewL(ApplicationRect());
    AddToStackL(iSplashContainer);
    iSplashContainer->MyTimer1L();
    //Run Timer;
    RTimer timer;// The asynchronous timer and ...
    TRequestStatus timerStatus;// ... its associated request status
    timer.CreateLocal();// Always created for this thread.
    // issue and wait for single request
    timer.After(timerStatus,5000000);// wait 3 second
    User::WaitForRequest(timerStatus);// wait for request to complete
    timer.Close();// close timer
    //Timer Over
    iMenuContainer = CMenuContainer::NewL(ApplicationRect());
    if(iSplashContainer){
    iEikonEnv->RemoveFromStack(iSplashContainer);
    delete iSplashContainer;
    iSplashContainer = NULL;
    }
    AddToStackL(iMenuContainer);

    }

  8. #8
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,166
    it would really work and also work nicely, if you just would read the posts and do accordingly .....

    in case you prefer doing it your way, then I can't really be too much on assistance here and you better figure it out by your self.

    Anyway, I'll explain the thing again (third time), you need to construct the timer in a way that it will call callback function when it expires, not as you have made it currently, since it will block and no drawing can be done while it is blocking, so please read the eralier posts and try again.

    yucca

  9. #9
    Registered User
    Join Date
    Jul 2004
    Posts
    43
    Thanks for your suggestions, and also patience

    I made a new Timer of type CPeriodic, which as you would know is a non-blocking timer. Everything is working, nicely
    My initial problem of calling CAppUI:GameController() is also, solved. The timer registers gamecontroller as it's callback. So I have the control in gamecontroller from where I can "rule the world".

    Many Thanks. This has been, for whatever it's worth, a big break through.

    Regards

Posting Permissions

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