Problema com datePicker

1 resposta
E

Eu gostaria de utilizar o componente datepicker do Laszlo, entretanto, os meses e os dias da semana necessitam ser em português, ao invés de inglês (default).
Por isso, alterei o dataset "datepicker_strings_en" na qual estão contidos os meses e coloquei os meses em portugês.
De certa forma funcionou, mas, nos 3 primeiros meses aparecem um quadradinho.
Fora isso, não consigo alterar as iniciais dos dias da semana.
Alguém tem alguma sugestão de como alterá-los e de como corrigir os meses?!

Abaixo segue o código:
<canvas>
  <dataset name="datepicker_strings_en">
    <months>
      <month index="0" full="Janeiro" abr="Jan月"/> 
      <month index="1" full="Fevereiro" abr="Fev月"/> 
      <month index="2" full="Marco" abr="Mar月"/> 
      <month index="3" full="Abril" abr="Abr"/> 
      <month index="4" full="Maio" abr="Mai"/> 
      <month index="5" full="Junho" abr="Jun"/> 
      <month index="6" full="Julho" abr="Jul"/> 
      <month index="7" full="Agosto" abr="Ago"/> 
      <month index="8" full="Setembro" abr="Set"/> 
      <month index="9" full="Outubro" abr="Out"/> 
      <month index="10" full="Novembro" abr="Nov"/>
      <month index="11" full="Dezembro" abr="Dez"/>	
    </months>
  </dataset>

  <simplelayout axis="y" spacing="5"/>
  <view>
  	<simplelayout axis="x" spacing="5"/>
  	<edittext id="birthyear" width="45"/>
  	<text text="年" width="15"/>
  	<edittext id="birthmonth" width="25"/>
  	<text text="月" width="15"/>
  	<edittext id="birthday" width="25"/>
  	<text text="日" width="15"/>
      
  <datepicker showingdate="new Date(2004,0,1)"
              earliestdate="new Date( 1900, 1, 1)"
              latestdate="new Date( 2005, 1, 5)"
              selecteddate="new Date( 2004, 0, 20)">
      <method event="onselecteddate">
          if( this.selecteddate != null ) {
              birthyear.setText ( this.selecteddate.getFullYear() );
              birthmonth.setText ( this.selecteddate.getMonth()+1 );
              birthday.setText( this.selecteddate.getDate() );
          }
      </method>
   </datepicker>
  </view>
</canvas>
[/img][/code]

1 Resposta

G

Oieeee Erich!!!
Dá uma olhadinha neste exemplo… acredito que possa te ajudar :slight_smile:
Bjux!!!

<?xml version="1.0" encoding="ISO-8859-1"?>
<canvas width="1000" bgcolor="#D3D3D3">
 <silverstyle name="silvercolors"/>

<dataset name="datepicker_strings_en">
    <months>
      <month index="0" full="Janeiro" abr="Jan"/>
      <month index="1" full="Fevereiro" abr="Fev"/>
      <month index="2" full="Marco" abr="Mar"/>
      <month index="3" full="Abril" abr="Abr"/>
      <month index="4" full="Maio" abr="Mai"/>
      <month index="5" full="Junho" abr="Jun"/>
      <month index="6" full="Julho" abr="Jul"/>
      <month index="7" full="Agosto" abr="Ago"/>
      <month index="8" full="Setembro" abr="Set"/>
      <month index="9" full="Outubro" abr="Out"/>
      <month index="10" full="Novembro" abr="Nov"/>
      <month index="11" full="Dezembro" abr="Dez"/>
    </months>
  </dataset>
<class name="myday"
           extends="basedatepickerday"
           bgcolor="#D3D3D3"
           width="20"
           height="20">
        <handler name="onclick">
        <![CDATA[
            if( !this.disabled  ) {
                this.setAttribute('selected', true);
            }
        ]]>
        </handler>

        <text text="${parent.daynum}"
              visible="${!parent.disabled}"
              opacity="${parent.selectable ? 1 : .3 }"/>
    </class>

  <class name="myweek" extends="basedatepickerweek">
        <simplelayout axis="x" spacing="1"/>
    </class>

    <class name="mydatepicker"
           extends="basedatepicker"
           weekclass="myweek"
           dayclass="myday"
           xinset="0"
           yinset="0"
           x="45" y="105">

        <method name="setMonthToShow" args="month, year">
            super.setMonthToShow(month,year);
            this.display.month.datapath.setXPath(
            "datepicker_strings_en:/months/month[@index='" + month + "']/@full" );
            this.display.year.setText( year );
        </method>

        <method name="sendAgenda" args="action">
        <![CDATA[
                var d=canvas.datasets.dsetAgenda;                       // 3
                var p=new LzParam();                                    // 3a
                p.addValue("action", action, true);
                p.addValue("month", selected.month.getText(), true);
                p.addValue("day", selected.date.getText(), true);
                p.addValue("year", selected.year.getText(), true);
                d.setQueryString(p);                                   // 3c
                d.doRequest();
          ]]>                                         // 3d
        </method>

        <handler name="onselecteddate">
            if( this.selecteddate != null ) {
                this.selected.year.setText( this.selecteddate.getFullYear() );
                this.selected.month.datapath.setXPath(
                        "datepicker_strings_en:/months/month[@index='" +
                        this.selecteddate.getMonth() + "']/@full" );
                this.selected.date.setText( this.selecteddate.getDate() );

                sendAgenda("search");                         // 5
                parent.datapath.updateData();
                var dp=canvas.datasets.dsetAgenda.getPointer();
                dp.selectChild();
                dp.addNodeFromPointer( parent.datapath );
                parent.setDatapath("new:/agenda");

            }
        </handler>


        <view options="ignorelayout">

            <text width="20" height="20" bgcolor="#B22222" text="D" fgcolor="white"/>
            <text width="20" height="20" bgcolor="#B22222" text="S" fgcolor="white"/>
            <text width="20" height="20" bgcolor="#B22222" text="T" fgcolor="white"/>
            <text width="20" height="20" bgcolor="#B22222" text="Q" fgcolor="white"/>
            <text width="20" height="20" bgcolor="#B22222" text="Q" fgcolor="white"/>
            <text width="20" height="20" bgcolor="#B22222" text="S" fgcolor="white"/>
            <text width="20" height="20" bgcolor="#B22222" text="S" fgcolor="white"/>
            <simplelayout axis="x" spacing="1"/>
        </view>

        <view name="display" bgcolor="white" x="0" width="145">
            <button x="0" width="20" height="20" onclick="classroot.showPreviousMonth()">
            <view resource="volta.gif" x="5" y="5"/>
            </button>

            <text  x="20" width="66" fontsize="10" fontstyle="bold" name="month" datapath="." />
            <text  width="35" fontsize="10" fontstyle="bold" name="year" />

            <button  width="20" height="20" onclick="classroot.showNextMonth()">
            <view resource="vai.gif" x="5" y="5"/>
            </button>
            <simplelayout axis="x" spacing="2"/>

        </view>

        <simplelayout axis="y" placement="content" spacing="1" inset="20"/>
        <simplelayout axis="y"/>

        <view  name="selected">
            <text y="30" ><b> Data </b></text>
            <text y="30" name="month" datapath="." resize="true" />
            <text y="30" name="date" resize="true"/>
            <text y="30" name="year" resize="true"/>

            <simplelayout axis="x" spacing="2"/>
        </view>


    </class>

  <class name="agend" extends="view" visible="true" >
    <!-- 2 -->


         <view y="46" x="14" height="26" width="747" bgcolor="#B22222">
               <text y="6" x="301" fgcolor="#E0EEE0" align="center"><font face="verdana"><b>Agenda</b></font></text>
         </view>

         <view y="80" x="220" height="510" width="2" bgcolor="#B22222">

         </view>

         <view>
         <list x="230" y="100" width="500" style="silvercolors">
              <textlistitem  fontstyle="bold" text="Compromissos" selected="true"/>

         </list>

        </view>
         <!--   <borderedbox bordersize="3" height="400" x="15" y="85" width="420"/> -->
     <!-- 4 -->

    <mydatepicker/>

  </class>
  
<agend name="newAgend" datapath="new:/agend" visible="true"/>

</canvas>
Criado 28 de março de 2007
Ultima resposta 2 de abr. de 2007
Respostas 1
Participantes 2