org.symbian.tools.wrttools.doc.WRTKit/html/WRTKit_Showing_content_in_a_view-GUID-7020d9ea-747d-42f3-b47c-16ad1f45db82.html
author Eugene Ostroukhov <eugeneo@symbian.org>
Mon, 15 Mar 2010 17:56:08 -0700
changeset 268 ef733cd772bb
parent 230 7848c135d915
permissions -rw-r--r--
Bug 2213 - User is not prompted to save when debug session is started
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
230
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
     1
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
     2
<html lang="en" xml:lang="en">
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
     3
<head>
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
     4
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
     5
<meta name="copyright" content="(C) Copyright 2005" />
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
     6
<meta name="DC.rights.owner" content="(C) Copyright 2005" />
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
     7
<meta content="concept" name="DC.Type" />
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
     8
<meta name="DC.Title" content="Showing content in a view" />
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
     9
<meta scheme="URI" name="DC.Relation" content="WRTKit_Common_WRTKit_tasks-GUID-24870895-4449-4307-9a54-7c90f7b3905e.html" />
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    10
<meta content="XHTML" name="DC.Format" />
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    11
<meta content="GUID-7020D9EA-747D-42F3-B47C-16AD1F45DB82" name="DC.Identifier" />
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    12
<meta content="en" name="DC.Language" />
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    13
<link href="commonltr.css" type="text/css" rel="stylesheet" />
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    14
<title>
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    15
Showing content in a view</title>
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    16
</head>
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    17
<body id="GUID-7020D9EA-747D-42F3-B47C-16AD1F45DB82"><a name="GUID-7020D9EA-747D-42F3-B47C-16AD1F45DB82"><!-- --></a>
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    18
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    19
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    20
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    21
    <h1 class="topictitle1">
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    22
Showing content in a view</h1>
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    23
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    24
    <div>
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    25
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    26
        <p>
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    27
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    28
            The WRTKit has two controls for showing content inside a view. The 
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    29
            first of the controls is called Label and is useful for simple and 
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    30
            short information to be displayed, coupled with the control caption 
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    31
            that describes the information.
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    32
        </p>
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    33
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    34
        <div class="fignone" id="GUID-7020D9EA-747D-42F3-B47C-16AD1F45DB82__GUID-EB15E9F3-204F-4772-B820-F3375D4C040A"><a name="GUID-7020D9EA-747D-42F3-B47C-16AD1F45DB82__GUID-EB15E9F3-204F-4772-B820-F3375D4C040A"><!-- --></a><span class="figcap">Figure 1. 
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    35
Label control</span>
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    36
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    37
            
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    38
            <br /><img src="Label_Control_Screenshot_1.png" /><br />
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    39
        </div>
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    40
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    41
        <p>
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    42
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    43
            The second control is called ContentPanel and is more sophisticated 
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    44
            than the Label control. ContentPanel controls can be created as 
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    45
            foldable, which means that they can expand and collapse their 
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    46
            content areas. Users can toggle the expanded and collapsed state by 
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    47
            clicking on the caption area of the ContentPanel.
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    48
        </p>
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    49
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    50
        <div class="fignone" id="GUID-7020D9EA-747D-42F3-B47C-16AD1F45DB82__GUID-5EC096E5-EADF-4BD6-9D6A-1B331EAA2E66"><a name="GUID-7020D9EA-747D-42F3-B47C-16AD1F45DB82__GUID-5EC096E5-EADF-4BD6-9D6A-1B331EAA2E66"><!-- --></a><span class="figcap">Figure 2. 
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    51
Foldable content panel</span>
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    52
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    53
            
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    54
            <br /><img src="RSS_Reader_Main_Screenshot_2.png" /><br />
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    55
        </div>
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    56
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    57
        <p>
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    58
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    59
            The code below creates a Label control and a foldable ContentPanel 
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    60
            control and adds them to a view. The code assumes that a view has 
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    61
            already been created and that a variable called exampleView refers 
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    62
            to it.
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    63
        </p>
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    64
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    65
<pre>
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    66
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    67
// create label
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    68
var nameLabel = new Label("label1", "Name");
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    69
exampleView.addControl(nameLabel);
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    70
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    71
// create foldable content panel
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    72
var infoPanel = new ContentPanel("info1", "Information", null, true);
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    73
exampleView.addControl(infoPanel);
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    74
</pre>
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    75
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    76
        <p>
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    77
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    78
            The first and second arguments are the same in the constructors for 
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    79
            both controls. The first is a unique identifier for the control and 
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    80
            the second is the control caption. The third argument is also the 
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    81
            same but is omitted for the label and null for the content panel 
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    82
            since in both cases we don't specify any content at this point. The 
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    83
            fourth argument for the content panel is a boolean that specifies 
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    84
            whether the control should be foldable or not.
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    85
        </p>
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    86
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    87
        <p>
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    88
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    89
            The value for a label can be set and retrieved using the getText() and
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    90
            setText() methods. For content panels the content in the content area
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    91
            can be set and retrieved using getContent() and setContent(). The
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    92
            content is defined as an XHTML fragment and can contain arbitrarily
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    93
            complex XHTML, including images or even JavaScript.
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    94
        </p>
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    95
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    96
<pre>
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    97
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    98
// set the text for the label
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
    99
nameLabel.setText("John Smith");
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
   100
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
   101
// set content for the content panel
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
   102
infoPanel.setContent("&lt;b&gt;This is bolded!&lt;/b&gt;&lt;br/&gt;This is plain text on the second line.");
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
   103
</pre>
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
   104
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
   105
        <p>
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
   106
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
   107
            Foldable ContentPanel controls can be programmatically collapsed or
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
   108
            expanded using the setExpanded() method. The expanded state can be
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
   109
            retrieved using the isExpanded() method.
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
   110
        </p>
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
   111
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
   112
<pre>
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
   113
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
   114
// retrieve the expanded state
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
   115
var expanded = infoPanel.isExpanded();
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
   116
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
   117
// collapse the content panel
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
   118
infoPanel.setExpanded(false);
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
   119
</pre>
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
   120
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
   121
    </div>
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
   122
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
   123
<div>
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
   124
<div class="familylinks">
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
   125
<div class="parentlink"><strong>Parent topic:</strong> <a href="WRTKit_Common_WRTKit_tasks-GUID-24870895-4449-4307-9a54-7c90f7b3905e.html">Common WRTKit tasks</a></div>
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
   126
</div>
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
   127
</div>
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
   128
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
   129
</body>
7848c135d915 Fixed 2046 - WRTKit Help. Renamed package for consistency.
tasneems@symbian.org
parents:
diff changeset
   130
</html>