Error en uso de TDatePicker en una ButtonBar...

Error en uso de TDatePicker en una ButtonBar...

Postby Carlos Sincuir » Thu Mar 09, 2006 10:28 pm

Hola a todos,
estoy colocando un control TDatePicker en una ButtonBar:

Code: Select all  Expand view
  aGet[3] := Date()
  DEFINE BUTTONBAR oBar OF oDlgCtc03 _3D
   @ 0.3,53 SAY oSay[2] PROMPT "Fecha de Corte:" OF oBar SIZE 80,14 FONT oWndMain:oFont
   @ 0.3,68 DTPICKER oGet[3] VAR aGet[3] OF oBar SIZE 95,18 UPDATE


Pues todo esto muy bien, se presenta bien el control en la barra, el error se da cuando deseo cambiar la fecha, se abre el calendario, se escoge la fecha con el mouse o con las flechas (en el control se ve que esta cambiando la fecha), y luego se confirma la fecha deseada, el control se vuelve a colocar la fecha con que se inicio.
Si la cambio con puro teclado sin utilizar el calendario, si se cambia la fecha.

Alguien a tenido este problema y sabrá como solucionarlo??

Gracias y saludos.

Carlos Sincuir
Carlos Sincuir
 
Posts: 38
Joined: Mon Nov 28, 2005 2:10 pm

Postby Antonio Linares » Sat Mar 11, 2006 1:06 am

Carlos,

Tienes que hacer los siguientes cambios para que funcione correctamente:

1. En la Clase TWindow:
Code: Select all  Expand view
METHOD Notify( nIdCtrl, nPtrNMHDR ) CLASS TWindow

   local nCode     := GetNMHDRCode( nPtrNMHDR )
   local nHWndFrom := GetNMHDRHWndFrom( nPtrNMHDR )
   local oCtrl     := oWndFromHwnd( nHWndFrom )

   if oCtrl != nil
      do case
         case nCode == 103 .or. nCode == TVN_SELCHANGEDA  // TreeView item selected
              oCtrl:SelChanged()

         otherwise
              if oCtrl:hWnd != ::hWnd
                 return oCtrl:Notify( nIdCtrl, nPtrNMHDR )
              endif   
      endcase
   endif

return nil

2. En la Clase TControl:
Code: Select all  Expand view
   // METHOD Notify( nIdCtrl, nPtrNMHDR ) VIRTUAL  // common controls notifications

3. En la Clase TDatePick (source\classes\tdtpicke.prg)
Code: Select all  Expand view
METHOD Notify( nIdCtrl, nPtrNMHDR ) CLASS TDatePick

   local nCode := GetNMHDRCode( nPtrNMHDR )
   
   if nCode == -759  // Date-time picker changed
      Eval( ::bSetGet, ::GetDate() )
      ::Change()
   endif
   
return nil     

Aqui con esos cambios, tu ejemplo funciona bien :)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41476
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Antonio Linares » Sat Mar 11, 2006 1:09 am

Este es el código del ejemplo que hemos probado:
Code: Select all  Expand view
#include "Fivewin.ch"
#include "dtpicker.ch"

FUNCTION MAIN()

    LOCAL oDlg, aGet := Array( 3 ), oGet := Array( 3 ), oSay := Array( 3 )

    DEFINE WINDOW oDlg TITLE "Test"

aGet[3] := Date()

    DEFINE BUTTONBAR oBar OF oDlg _3D

    @ 0.3,53 SAY oSay[2] PROMPT "Fecha de Corte:" OF oBar SIZE 80,14

    @ 0.3,68 DTPICKER oGet[3] VAR aGet[3] OF oBar SIZE 95,18 UPDATE

    ACTIVATE WINDOW oDlg

    RETURN NIL
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41476
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 57 guests