×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Apr 2004
    Posts
    23

    aboutView.removeControl(content01); WRTKit tip for novices

    Within the parameters of WRTKit I was creating an About page and noticed if the user clicked About on the softkey menu more than once the About content kept on concatenating on the screen. Too many Abouts. Then I discovered removeControl(); and this solved the problem. Perhaps there is a more elegant and efficient way to solve this issue, in the mean time here is the code that solved the concatenation issue for me:

    //Displays the About view
    function showAboutView(){
    aboutLabel.setText("");
    //
    aboutView.removeControl(content01); // remove previous content01
    // as would happen when user clicks About two or more times
    //
    // add a content panel WRTKit/UI/ContentPanel.js
    content01 = new ContentPanel("",
    "Fookie - Version 1.01wrt<br />",
    "Created by Steve Bull<br />" +
    "Powered by Cutlass, Inc.<br />" +
    "[www.ctlss.com]<br />" +
    "56 Ludlow Street<br />" +
    "New York NY 10002<br />" +
    "United States of America<br />" +
    "+01.212-388-9121 - phone<br />" +
    "info@CTLSS.com<br />" +
    "&copy; 2004-2009 Cutlass<br />" +
    "Fortune cookie + lucky numbers = FOOKIE");
    aboutView.addControl(content01);
    uiManager.setView(aboutView);
    }


    Before the above function is called be sure to instanciate your variables in your principal .js script like:

    // Reference to the WRTKit user interface manager and main view.
    var uiManager;
    var mainView;
    var aboutView;
    var faqView;
    var historyView;
    .....

    // view label control
    var mainLabel;
    var aboutLabel;
    .....

    // ContentPanel
    var content01;
    var f01,f02,ln01;
    var his00,his01,his02,his03,his04,his05,his06,his07,his08;
    ........

  2. #2
    Nokia Developer Champion
    Join Date
    Nov 2007
    Location
    Rome, Italy
    Posts
    2,405

    Re: aboutView.removeControl(content01); WRTKit tip for novices

    Hi captain_dixie,

    since you're creating a new ContentPanel instance each time the user presses on the About button, then only way to avoid to have more instances at once would be to remove them as you already do.

    A possible alternative would be to create a ContentPanel instance at the beginning, and then reuse that instance when needed.

    Pit

  3. #3
    Registered User
    Join Date
    Apr 2004
    Posts
    23

    Re: aboutView.removeControl(content01); WRTKit tip for novices

    Hi Pit,

    Thank you. I am rediscovering javascript thus my brain is partially understanding your 'alternative would be to create a ContentPanel instance at the beginning'--I'll look into this more.

    Steve (aka Captain_Dixie)

  4. #4
    Nokia Developer Champion
    Join Date
    Nov 2007
    Location
    Rome, Italy
    Posts
    2,405

    Re: aboutView.removeControl(content01); WRTKit tip for novices

    Hi Steve,

    sorry for not being clear enough

    The approach I have proposed is to create the about ContentPanel instance at the start of your widget, and then dynamically show/hide it depending on widget needs.

    Anyway, your approach is not wrong at all: dynamically appending and removing nodes is also better from a memory-related point of view, since the widget's DOM structure will contain only the strictly needed elements.

    Pit

Similar Threads

  1. WRTkit focus highlight style problems
    By hp3 in forum Symbian Web Runtime
    Replies: 1
    Last Post: 2010-02-16, 08:21
  2. Where is the lastest stable version of WRTKit for WRT1.0
    By gbridge0 in forum Symbian Web Runtime
    Replies: 3
    Last Post: 2009-01-25, 21:12
  3. WRTKit Documentation on Forum Nokia Library?
    By bryanrieger in forum Symbian Web Runtime
    Replies: 2
    Last Post: 2009-01-21, 10:09
  4. Why is there always tip message show before SMS after JAVA Sign?
    By nb0574119 in forum Mobile Java Networking & Messaging & Security
    Replies: 4
    Last Post: 2007-11-29, 00:16
  5. Why is there always tip message show before SMS after JAVA Sign?
    By nb0574119 in forum Web Technologies and Multimedia Content- Web 技术和多媒体内容
    Replies: 0
    Last Post: 2007-11-23, 02:28

Posting Permissions

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