I put "UPDATE" con control say and I used settext funcion to refresh the text
why not run ok ?
this is the test
try to select two days
Code: Select all
#include "Fivewin.ch"
#include "dtpicker.ch"
static dfirst,dLast
Function test()
local oDlg, oFont,oLarge,oBold
local oFolder,oFld
local oDtpFirst, oDtpLast
local dStagioneMin,dStagioneMax
local nGiorni:= 1,oGiorni,oGiornitext
SET DATE ITALIAN
SET CENTURY ON
dFirst := date()
dLast := date()
dStagioneMin := ctod("17/06/2020")
dStagioneMax := ctod("20/09/2020")
DEFINE FONT oFont NAME "Segoe UI" SIZE 0,-16
DEFINE FONT oBold NAME "Segoe UI" SIZE 0,-14 BOLD
DEFINE FONT oLarge NAME "VERDANA" SIZE 0,-24 BOLD
DEFINE DIALOG oDlg SIZE 1130,650 PIXEL FONT oFont ;
TITLE "Test" ;
STYLE nOR( WS_CAPTION, WS_MAXIMIZEBOX, WS_MINIMIZEBOX, WS_THICKFRAME )
@ 1, 0 FOLDEREX oFolder OF oDlg SIZE oDlg:nWidth-585,oDlg:nHeight-390 PIXEL ;
PROMPT "Prenotazioni","Pagamenti","Familiari"
@ 6,120 SAY "Dal :" SIZE 20,11 PIXEL OF oFolder:aDialogs[1] TRANSPARENT FONT oBold
@ 23,120 SAY "al :" SIZE 20,11 PIXEL OF oFolder:aDialogs[1] TRANSPARENT FONT oBold
@ 3, 145 DTPICKER oDtpFirst VAR dFirst SIZE 90,12 PIXEL OF oFolder:aDialogs[1] ;
PICTURE "ddd dd mmm yyyy" UPDATE;
ON CHANGE ( oDtpLast:SetRange( dFirst ), oDlg:Update() )
WITH OBJECT oDtpFirst
:lNoToday := .t.
:lNoTodayCircle := .t.
:SetRange( dStagioneMin,dStagioneMax )
END
@ 22,145 DTPICKER oDtpLast VAR dLast SIZE 90,12 PIXEL OF oFolder:aDialogs[1] ;
PICTURE "ddd dd mmm yyyy" UPDATE ;
ON CHANGE Rinfresca(@oGiorni,@oGiorniText,dFirst,dLast)
@ 08.6,300 SAY oGiorni Prompt nGiorni SIZE 38,20 PIXEL OF oFolder:aDialogs[1];
FONT oLarge color RGB( 165, 186, 204 ) center UPDATE
@ 08.6,300 SAY oGiornitext Prompt (if( nGiorni>1,"giorni","giorno")) ;
SIZE 50,16 PIXEL OF oFolder:aDialogs[1] FONT oLarge;
color RGB( 165, 186, 204 ) UPDATE
oDlg:bResized := <||
oRect := oDlg:GetCliRect()
oFolder:nWidth := oRect:nRight-2
oFolder:nHeight := oRect:nBottom-160
oGiorni:nTop := oFolder:ntop +4
oGiorni:nLeft := oFolder:nleft+480
oGiorniText:nTop := oFolder:ntop +44
oGiorniText:nLeft := oFolder:nleft+480
return nil
>
ACTIVATE DIALOG oDlg CENTERED
return nil
//-------------------------------------------------------------------//
Function Rinfresca(oGiorni,oGiorniText,dFirst,dLast)
local nGiorni:=(dLast-dFirst)+1
oGiorni:Settext(ltrim(str(nGiorni)))
oGiorni:refresh()
oGiornitext:Settext(if( nGiorni>1,"giorni","giorno"))
oGiornitext:refresh()
return nil