The Media Center Sandbox

Resources and discussion for developing experiences in the Windows Media Center platform.
Welcome to The Media Center Sandbox Sign in | Join | Help
in Search

How to pass values from multiple editabletext to vb code through a button

Last post 12-23-2009, 3:48 AM by AndyC. 1 replies.
Sort Posts: Previous Next
  •  12-23-2009, 1:53 AM 9514

    How to pass values from multiple editabletext to vb code through a button

    hi
    im beginer for mcml, im doing about edit string
    i used editabletext i wanna pass values from 3 editabletext  to vb code through a button


     <UI Name="TestSimpleEditbox">

     
        <Content>
          <Panel Layout ="Form">
            <Children >
             
                <!-- Simple edit box that limits the number of characters allowed. -->

                <me:SimpleEditbox MaxChars="10">
                    <EditableText>
                        <EditableText Value=""/>
                    </EditableText>
                </me:SimpleEditbox>
               
                <me:SimpleEditbox2 MaxChars="10">
                    <EditableText>
                        <EditableText Value=""/>
                    </EditableText>
                </me:SimpleEditbox2>
               
                <me:SimpleEditbox3 MaxChars="10">           
                    <EditableText>
                        <EditableText Value=""/>
                    </EditableText>
                </me:SimpleEditbox3>
       
            </Children>
          </Panel>
        </Content>
      </UI>

    <UI Name="SimpleEditbox">

        <Properties>

          <!-- EditableText is a required parameter. -->
          <EditableText Name="EditableText" EditableText="$Required"/>

          <!-- Limit the number of characters allowed. -->
          <cor:Int32 Name="MaxChars" Int32="10"/>

          <!-- Background color. -->
          <Color Name="BackgroundColor" Color="DimGray"/>
          <Color Name="BackgroundFocusedColor" Color="DarkGray"/>

          <!-- Label color. -->
          <Color Name="CurcorColor" Color="Red"/>
          <Color Name="FontColor" Color="Blue"/>

        </Properties>

        <Locals>
            <Command Name="OK"  Description="OK1" />
          <!-- React to typing input. -->
          <TypingHandler Name="TypingHandler" EditableText="[EditableText]"/>
          <a:MyStringValue Name="MyNetObject"/>   
        </Locals>

          <Rules>
              <!-- The editable text value is bound to the label text value.
          <Binding Source="[EditableText.Value]" Target="[Label2.Content]"/>-->
              <Binding Source="[MyNetObject.Username]" Target="[Label.Content]"/> 
              <Binding Source="[TypingHandler.DisplayValue]" Target="[Label.Content]"/>

              <!-- Change color if in overtype mode. -->
              <Condition Source="[EditableText.Overtype]" SourceValue="true">
                  <Actions>

                      <Set Target="[Overtype.Visible]" Value="true"/>
                      <Set Target="[Caret.Visible]" Value="false"/>
                      <Set Target="[Label.Content]" Value=""/>
                  </Actions>
              </Condition>

              <!-- Change color on key focus. -->
              <Condition Source="[Input.KeyFocus]" SourceValue="true">
                  <Actions>
                      <Set Target="[Background.Content]" Value="[BackgroundFocusedColor]"/>
                      <Set Target="[Label.Color]" Value="[FontColor]"/>
                      <Set Target="[Caret.Visible]" Value="true"/>
                  </Actions>
              </Condition>

              <!-- Stop typing when the maximum number of characters has been reached. -->
              <Changed Source="[EditableText.Value]">
                  <Conditions>
                      <Equality Source="[EditableText.Value.Length]" ConditionOp="GreaterThan" Value="[MaxChars]"/>
                  </Conditions>
                  <Actions>
                      <Invoke Target="[EditableText.Value.Substring]" ResultTarget="[EditableText.Value]" startIndex="0" length="[MaxChars]"/>
                  </Actions>
              </Changed>

              <Changed Source="[OK.Invoked]">
       
                  <Actions>
                      <Set Target="[MyNetObject.Password]" Value="[TypingHandler.DisplayValue]"/>             
                  </Actions>
               

              </Changed>
              <Changed Source="[OK.Invoked]">
                  <Actions>
                      <Navigate Source="@resx://testmcml/testmcml.Resources/readdat"></Navigate>
                  </Actions>
              </Changed>
          </Rules>
        <Content>
          <Panel Layout ="Form">
            <Children >
              <ColorFill Content ="Black">
                <LayoutInput>
                  <FormLayoutInput Top="Parent,0.3" Left="Parent,0.1"/>
                </LayoutInput>
                <Children >
                  <Text Content ="UserName" Color ="White" />
                </Children>
              </ColorFill>
                <ColorFill Content ="Black">
                    <LayoutInput>
                        <FormLayoutInput Top="Parent,0.6" Left="Parent,0.4"/>
                    </LayoutInput>
                    <Children>
                        <b:Button Model1="[OK]"/>
                    </Children>
                </ColorFill>

                <!-- Solid background color. -->
          <ColorFill Name="Background" Content="[BackgroundColor]"
                     MouseInteractive="true" Padding="5,5,5,5"
                      Layout="Anchor" MinimumSize="325,0" MaximumSize="325,0">

            <LayoutInput>
              <FormLayoutInput Top="Parent,0.3" Left="Parent,0.3"/>
            </LayoutInput>
            <Children>

              <!-- Display the current value. -->
              <Text Name="Label" Color="[CurcorColor]" Font="Arial,20"
                    HorizontalAlignment="Far" Margins="0,0,10,0" MinimumSize="0,30"/>

               <!--Display the caret.-->
              <ColorFill Name="Caret" Content="[CurcorColor]" Visible="false" MinimumSize="12,4">

                <LayoutInput>
                  <AnchorLayoutInput Left="Label,1,-10" Top="Label,0" Bottom="Label,1" Vertical="Far"/>
                </LayoutInput>

              </ColorFill>

               <!--Overtype fill.-->

              <ColorFill Name="Overtype" Content="Black" Visible="false">

                <LayoutInput>
                  <AnchorLayoutInput Left="Label,0" Right="Label,1" Top="Label,0" Bottom="Label,1"/>
                </LayoutInput>

              </ColorFill>
            </Children>
          </ColorFill>
             
            </Children>
          </Panel>  
        </Content>
      </UI>

    Thank you for your help.

    best regards ,
    seko

     
  •  12-23-2009, 3:48 AM 9515 in reply to 9514

    Re: How to pass values from multiple editabletext to vb code through a button

    To use them in VB you'll need to create the EditableText objects in your code, and pass them into MCML as properties.

    Look at the "Z" application in the Media Center SDK for an example of how to do this.

    Cheers,
    Andrew
View as RSS news feed in XML
Powered by Community Server, by Telligent Systems