si hago:
- Code: Select all Expand view RUN
oBrw:end()
sin cerrar el dialogo, el objeto browse sigue estando y no se cierra, alguna idea?
Saludos
oBrw:end()
#include 'FiveWin.ch'
#include 'ssay.ch'
#include 'dtpicker.ch'
#include "xbrowse.ch"
Static oFnt, oFnt1, oFnt2, oFnt3, oFnt4, nRow, nCol, dCal, oBrw[42], aAlias[31], cOperatore
MEMVAR oV
*********
Procedure Eventi( dCalPar )
*********
local old_sel := select()
local oDlg, oBrw[42]
local n, x, o, nMth, oMeseAnno
Default dCalPar := DATE()
dCal := dCalPar
cOperatore := oV:codOpeDefault
dCal := CTOD( "01/" + NTRIM( MONTH( dCal ) ) + "/" + NTRIM( YEAR( dCal ) ) )
nRow := 20
nCol := 1
IF !FILE( oV:arc_dir + "eventi.dat" )
DBCREATE( oV:arc_dir + "eventi.dat", {;
{ "EVN_DATE" , "D", 8, 0 },;
{ "EVN_TIME" , "C", 5, 0 },;
{ "EVN_SUBJ" , "C", 20, 0 },;
{ "EVN_IDOUT", "C", 45, 0 },;
{ "EVN_OP" , "C", 2, 0 },;
{ "EVN_MEMO" , "M", 10, 0}})
ENDIF
IF !FILE( oV:arc_dir + "eventi.ind" )
SELECT 0
USE ( oV:arc_dir + "eventi.dat" ) NEW ALIAS eventi EXCLUSIVE
INDEX ON DTOS( FIELD->EVN_DATE ) + FIELD->EVN_TIME TAG uno TO ( oV:arc_dir + "eventi.ind" )
INDEX ON FIELD->EVN_IDOUT TAG due TO ( oV:arc_dir + "eventi.ind" )
USE
ENDIF
IF EMPTY( oFnt )
DEFINE FONT oFnt NAME "Ms Sans Serif" SIZE 0,-12 BOLD
DEFINE FONT oFnt1 NAME "Ms Sans Serif" SIZE 0,-12
DEFINE FONT oFnt2 NAME "Ms Sans Serif" SIZE 0,-8
DEFINE FONT oFnt3 NAME "Ms Sans Serif" SIZE 0,-16 BOLD
DEFINE FONT oFnt4 NAME "Ms Sans Serif" SIZE 0,-18 BOLD ITALIC
oFnt:lDestroy := .F.
oFnt1:lDestroy := .F.
oFnt2:lDestroy := .F.
ENDIF
DEFINE DIALOG oDlg FROM 0, 0 TO 640,910 TITLE 'Eventi: ' + oV:cNameDitta PIXEL ;
FONT oFnt1 OF RetMainWnd()// COLOR CLR_YELLOW, CLR_WHITE
@ 0, 000 BUTTON "<--" PIXEL SIZE 64,8 ACTION CambiaMese( oDlg, -1, oMeseAnno ) // MostraEventi( @dCal, oDlg ) )
@ 0, 100 BUTTON "Outlook -->" PIXEL SIZE 64,8 ACTION IIF( msgYesNo("Aggiorna Calendario da Outlook?" ), ( PrendiDatiOutlook(), oDlg:end(), Eventi( dCal ) ), "" )
@ 0, 290 SAY "Operatore" PIXEL SIZE 64,8
@ 0, 320 GET cOperatore PICTURE "99" PIXEL SIZE 10,8
@ 0, 391 BUTTON "-->" PIXEL SIZE 64,8 ;
ACTION CambiaMese( oDlg, 1, oMeseAnno )
//ACTION ( IIF( MONTH( dCal ) = 12, dCal := CTOD( "01/01/" + NTRIM( YEAR( dCal) + 1 ) ), dCal := CTOD( "01/" + NTRIM( MONTH( dCal ) + 1 ) + "/" + NTRIM( YEAR( dCal) ) ) ), oDlg:end(), Eventi( dCal ) ) // MesePiu( oDlg )
@ 0,187 SENSITIVE SAY oMeseAnno PROMPT CMESE( dCal ) + " " + NTRIM( YEAR( dCal ) ) ;
OF oDlg ;
SIZE 80,10 ;
CENTER ;
PIXEL ;
FONT oFnt3;
COLOR CLR_BLUE, CLR_HGRAY SHADOW;
COLOROVER CLR_BLUE
// ;
// COLOR CLR_WHITE, CLR_RED ;
// oMeseAnno:bLDblClick := {|nRow, nCol | msginfo(1) }
oMeseAnno:bLClicked := {|nRow, nCol | IIF( SelezionaData( @dCal ), ( CambiaMese( oDlg, 0, oMeseAnno, dCal ) ), "" ) }
@ 11.0, 1 SAY 'Domenica' ;
OF oDlg ;
SIZE 64, 8 ;
CENTER ;
PIXEL ;
FONT oFnt ;
COLOR CLR_WHITE, CLR_BLUE ;
@ 11.0,66 SAY 'Lunedì' ;
OF oDlg ;
SIZE 64, 8 ;
CENTER ;
PIXEL ;
FONT oFnt ;
COLOR CLR_WHITE, CLR_BLUE ;
@ 11.0,131 SAY 'Martedì' ;
OF oDlg ;
SIZE 64, 8 ;
CENTER ;
PIXEL ;
FONT oFnt ;
COLOR CLR_WHITE, CLR_BLUE ;
@ 11.0,196 SAY 'Mercoledì' ;
OF oDlg ;
SIZE 64, 8 ;
CENTER ;
PIXEL ;
FONT oFnt ;
COLOR CLR_WHITE, CLR_BLUE ;
@ 11.0,261 SAY 'Giovedì' ;
OF oDlg ;
SIZE 64, 8 ;
CENTER ;
PIXEL ;
FONT oFnt ;
COLOR CLR_WHITE, CLR_BLUE ;
@ 11.0,326 SAY 'Venerdì' ;
OF oDlg ;
SIZE 64, 8 ;
CENTER ;
PIXEL ;
FONT oFnt ;
COLOR CLR_WHITE, CLR_BLUE ;
@ 11.0,391 SAY 'Sabato' ;
OF oDlg ;
SIZE 64, 8 ;
CENTER ;
PIXEL ;
FONT oFnt ;
COLOR CLR_WHITE, CLR_BLUE ;
ACTIVATE DIALOG oDlg CENTER ON INIT MostraEventi( dCal, oDlg )
nMth := month(dCal)
for o := 1 to 31
aAlias[o] := 'A'+strzero(o,2)
IF SELECT( (aAlias[o]) ) != 0
(aAlias[o])->( dbCloseArea() )
ENDIF
next
// CLOSE ALL
return
*********************
***************
STATIC FUNCTION MostraEventi( dCal, oDlg )
***************
LOCAL nMth, o, n, x
nRow := 40 // 20
nCol := 1 // 1
FOR n := 1 TO 31
IF !EMPTY( oBrw[n] )
oBrw[n]:end()
ENDIF
NEXT
dCal := CTOD( "01/" + NTRIM( MONTH( dCal ) ) + "/" + NTRIM( YEAR( dCal ) ) )
nMth := month(dCal)
for o := 1 to 31
aAlias[o] := 'A'+strzero(o,2)
IF SELECT( (aAlias[o]) ) != 0
(aAlias[o])->( dbCloseArea() )
ENDIF
USE ( oV:arc_dir + "eventi.dat" ) INDEX ( oV:arc_dir + "eventi.ind" ) ALIAS (aAlias[o]) SHARED NEW
next
for n := 0 to 5
for x := 1 to 7
if nMth = month(dCal)
if dow(dCal) <= x
MakeBrw( (n*7)+x, oDlg, dCal )
dCal += 1
end
if nCol >= 780
nRow += 100 // 50
nCol := 1
else
nCol += 130 // 65
end
end
next
next
RETURN NIL
*
** eof MostraEventi
#define COLOR_ACTIVECAPTION 2
#define COLOR_WINDOW 5
#define COLOR_CAPTIONTEXT 9
#define COLOR_HIGHLIGHT 13
#define COLOR_HIGHLIGHTTEXT 14
#define COLOR_BTNFACE 15
#define COLOR_BTNTEXT 18
********
Function MakeBrw( n, xDlg, dDate )
********
LOCAL nTipoBrowse := 2, oCol
if !empty(dDate)
SELECT(aAlias[day(dDate)])
// (aAlias[day(dDate)])->(DbSeek(dtos(dDate)))
(aAlias[day(dDate)])->( ordScope(0,dtos(dDate)))
(aAlias[day(dDate)])->( ordScope(1,dtos(dDate)))
(aAlias[day(dDate)])->(DbGoTop())
//Twbrowse():lVScroll := .F.
//Twbrowse():lHScroll := .F.
//msginfo( "Row: " + NTRIM( nRow ) + " - n: " + NTRIM( n ) )
IF (aAlias[day(dDate)])->( ordKeyCount() ) > 5
//msginfo("Maggiore a 5: " + NTRIM( n) )
ENDIF
IF nTipoBrowse = 1
@ nRow, nCol LISTBOX oBrw[n] FIELDS (aAlias[day(dDate)])->EVN_TIME, (aAlias[day(dDate)])->EVN_SUBJ ;
FIELDSIZES 30, 120 ;
SIZE 65, 50 ;
PIXEL ;
FONT oFnt2 ;
HEADERS '', PADL( str(day(dDate),2), 15 ) ;
OF xDlg ;
ON DBLCLICK ( VediUnGiorno( dDate, xDlg, n ),;
(aAlias[day(dDate)])->( ordScope(0,dtos(dDate))),;
(aAlias[day(dDate)])->( ordScope(1,dtos(dDate))),;
(aAlias[day(dDate)])->(DbGoTop()), oBrw[n]:refresh(.T.) )
oBrw[n]:nStyle := nOR( WS_CHILD,;
WS_BORDER, WS_VISIBLE, WS_TABSTOP )
oBrw[n]:aJustify := { .F., .F. }
if dDate = DATE()
oBrw[n]:nClrForeHead := CLR_WHITE
oBrw[n]:nClrBackHead := CLR_HBLUE
elseif dow(dDate) = 1
oBrw[n]:nClrForeHead := CLR_WHITE
oBrw[n]:nClrBackHead := CLR_RED
elseif dow(dDate) = 7
oBrw[n]:nClrForeHead := CLR_WHITE
oBrw[n]:nClrBackHead := RGB( 193, 0, 0 ) // CLR_MAGENTA
else
oBrw[n]:nClrForeHead := CLR_BLACK // oBrw[n]:nClrText
oBrw[n]:nClrBackHead := CLR_WHITE //oBrw[n]:nClrPane
end
oBrw[n]:nLineStyle := 0 // 0 = NONE LINES_V_GRAY // LINES_DOTED // LINES_GRAY
// oBrw[n]:nClrBackFocus := GetSysColor( COLOR_HIGHLIGHT )
// oBrw[n]:nClrForeFocus := GetSysColor( COLOR_HIGHLIGHTTEXT )
oBrw[n]:nClrPane = CLR_WHITE
oBrw[n]:nClrText = CLR_BLACK
oBrw[n]:nClrBackNotFocus := CLR_WHITE
oBrw[n]:nAt := 1
// oBrw[n]:bFont := { |nRow,nCol,nStyleLine| if(nStyleLine=1,if(dDate = date(), oFnt4:hFont , oFnt:hFont ), ) }
oBrw[n]:bRClicked := { | nRow, nCol, nFlags | (oBrw[n]:SetFocus(), ;
oBrw[n]:lButtonDown(nRow,nCol), ShowPopup( nRow, nCol, xDlg, oBrw[n], dDate )) }
//oBrw[n]:cTooltip := {|| if( !empty((aAlias[day(dDate)])->EVN_MEMO), (aAlias[day(dDate)])->EVN_MEMO, "" ) }
oBrw[n]:nClrForeFocus:= CLR_BLACK
oBrw[n]:nClrBackFocus:= CLR_HGRAY // GetSysColor( COLOR_HIGHLIGHT )
ELSE
oBrw[n] := TXBrowse():New( xDlg )
//WriteInfoTxt( NTRIM( N ) + ") " + NTRIM( xDlg:nTop ) + " " + NTRIM( xdlg:nRight ), , "class.txt", .T. )
oBrw[n]:nTop := nRow
oBrw[n]:nLeft := nCol
oBrw[n]:nBottom := nRow + 100
oBrw[n]:nRight := nCol + 130
//
oBrw[n]:cAlias := (aAlias[day(dDate)])
//
oBrw[n]:SetFont( oFnt2 )
oBrw[n]:nMarqueeStyle := MARQSTYLE_HIGHLROW
oBrw[n]:nColDividerStyle := LINESTYLE_NOLINES
oBrw[n]:nRowDividerStyle := LINESTYLE_NOLINES
oBrw[n]:lColDividerComplete := .t.
oBrw[n]:nHeaderLines := 1
oBrw[n]:nDataLines := 1
oBrw[n]:lFastEdit := .F.
oBrw[n]:lAllowColHiding := .F.
oBrw[n]:lRecordSelector := .F.
oBrw[n]:lVScroll := .F.
oBrw[n]:lHScroll := .F.
oBrw[n]:bClrHeader := {|| IIF( dDate = DATE(), { CLR_RED, CLR_HBLUE }, { GetSysColor( COLOR_BTNTEXT ), GetSysColor( COLOR_BTNFACE ) } ) }
oBrw[n]:bLDblClick := {|| ( VediUnGiorno( dDate, xDlg, n ),;
(aAlias[day(dDate)])->( ordScope(0,dtos(dDate))),;
(aAlias[day(dDate)])->( ordScope(1,dtos(dDate))),;
(aAlias[day(dDate)])->(DbGoTop()), oBrw[n]:refresh(.T.) ) }
oBrw[n]:bRClicked := { | nRow, nCol, nFlags | ( oBrw[n]:SetFocus(), ;
oBrw[n]:lButtonDown(nRow,nCol), ShowPopup( nRow, nCol, xDlg, oBrw[n], dDate )) }
// Codice
oCol := oBrw[n]:AddCol()
oCol:cHeader := ""
oCol:bStrData := { || (aAlias[day(dDate)])->EVN_TIME }
oCol:bClrStd := { || Colore( (aAlias[day(dDate)])->EVN_OP ) }
//oCol:bClrHeader := { || IF( art->( ordSetFocus() ) == "UNO", {CLR_WHITE, CLR_RED}, { GetSysColor( COLOR_BTNTEXT ), GetSysColor( COLOR_BTNFACE ) } ) }
//oCol:bRClickData := { || art->( ordSetFocus(1) ), oLbxArt:refresh() }
oCol:bRClickData := { | nRow, nCol, nFlags | ( oBrw[n]:SetFocus(), ;
oBrw[n]:lButtonDown(nRow,nCol), ShowPopup( nRow, nCol, xDlg, oBrw[n], dDate )) }
// Descrizione
oCol := oBrw[n]:AddCol()
oCol:cHeader := str(day(dDate),2) //
oCol:nHeadStrAlign := AL_CENTER
oCol:oHeaderFont := IIF( dDate = DATE(), oFnt, oFnt1 )
oCol:bStrData := { || (aAlias[day(dDate)])->EVN_SUBJ }
oCol:bClrStd := { || Colore( (aAlias[day(dDate)])->EVN_OP ) }
//oCol:bClrHeader := { || IF( art->( ordSetFocus() ) == "DUE", {CLR_WHITE, CLR_RED}, { GetSysColor( COLOR_BTNTEXT ), GetSysColor( COLOR_BTNFACE ) } ) }
//oCol:bRClickData := { || art->( ordSetFocus(2) ), oLbxArt:refresh() }
oCol:bRClickData := { | nRow, nCol, nFlags | ( oBrw[n]:SetFocus(), ;
oBrw[n]:lButtonDown(nRow,nCol), ShowPopup( nRow, nCol, xDlg, oBrw[n], dDate )) }
oBrw[n]:SetRDD()
oBrw[n]:CreateFromCode()
oBrw[n]:adjust()
ENDIF
end
return NIL
*-------------------------------*
Function ShowPopup( nRow, nCol, oDlg, oLbx, dDate )
local oMenu
MENU oMenu POPUP
MENUITEM 'Nuovo ' ACTION (AddEvent(oLbx,dDate,.T.))
MENUITEM 'Modifica ' ACTION (AddEvent(oLbx,dDate,.F.))
MENUITEM 'Cancella ' ACTION (DelEvent(oLbx,dDate))
ENDMENU
ACTIVATE POPUP oMenu OF oDlg AT oLbx:nTop+nRow, oLbx:nLeft+nCol+4
return nil
*-----------------*
Procedure AddEvent( oLbx, dDate, lNew )
local oDlg, oGet[4], oBtn
local cTime, cSubj, cMemo, lSave, cOp
if lNew
cTime := LEFT( TIME(), 5 )// space(5)
cSubj := space(50)
cMemo := space(500)
cOp := cOperatore
else
cTime := (aAlias[day(dDate)])->EVN_TIME
cSubj := (aAlias[day(dDate)])->EVN_SUBJ
cMemo := (aAlias[day(dDate)])->EVN_MEMO
cOp := (aAlias[day(dDate)])->EVN_OP
end
lSave := .F.
DEFINE DIALOG oDlg FROM 0, 0 TO 210, 290 TITLE IIF( lNew, 'Nuovo Evento', 'Modifica Evento' ) PIXEL
@ 3 , 5 SAY 'Ora' SIZE 30, 10 OF oDlg PIXEL
@ 15 , 5 SAY 'Evento' SIZE 30, 10 OF oDlg PIXEL
@ 27 , 5 SAY 'Operatore' SIZE 30, 10 OF oDlg PIXEL
@ 39 , 5 SAY 'Nota' SIZE 30, 10 OF oDlg PIXEL
@ 2 , 30 GET cTime PICTURE '99:99' SIZE 20, 10 PIXEL
@ 14 , 30 GET cSubj PIXEL SIZE 110, 10
@ 26 , 30 GET cOp PIXEL SIZE 10, 10
@ 38 , 30 GET cMemo SIZE 110, 50 PIXEL MEMO
@ 88 ,108 BUTTON '&Salva' SIZE 30, 14 PIXEL OF oDlg ;
ACTION (lSave := .T., oDlg:End())
ACTIVATE DIALOG oDlg CENTER
if lSave
if lNew
(aAlias[day(dDate)])->(DbAppend())
end
if (aAlias[day(dDate)])->(Rlock())
(aAlias[day(dDate)])->EVN_DATE := dDate
(aAlias[day(dDate)])->EVN_TIME := cTime
(aAlias[day(dDate)])->EVN_SUBJ := cSubj
(aAlias[day(dDate)])->EVN_MEMO := alltrim(cMemo)
(aAlias[day(dDate)])->evn_op := cOp
end
(aAlias[day(dDate)])->(DbCommit())
(aAlias[day(dDate)])->(DbUnlock())
(aAlias[day(dDate)])->(DbGoTop())
// oLbx:GoTop()
oLbx:Refresh(.T.)
end
return
*-----------------------*
Procedure DelEvent(oLbx,dDate)
if (aAlias[day(dDate)])->(Rlock())
(aAlias[day(dDate)])->(DbDelete())
end
(aAlias[day(dDate)])->(DbCommit())
(aAlias[day(dDate)])->(DbUnlock())
(aAlias[day(dDate)])->(DbGoTop())
//oLbx:BugUp()
oLbx:Refresh(.T.)
return
********
FUNCTION VediUnGiorno( dDate, xDlg, n )
********
LOCAL oDlg, cAlias := select()
LOCAL oBrw, nOption := 2, oCol
SELECT(aAlias[day(dDate)])
(aAlias[day(dDate)])->( ordScope(0,dtos(dDate)))
(aAlias[day(dDate)])->( ordScope(1,dtos(dDate)))
(aAlias[day(dDate)])->(DbGoTop())
DEFINE DIALOG oDlg FROM 0, 0 TO 440, 510 TITLE 'Evento del ' + DTOC( dDate ) PIXEL ;
FONT oFnt1 OF xDlg
IF nOption = 1
@ 20, 0 LISTBOX oBrw FIELDS (aAlias[day(dDate)])->EVN_TIME, (aAlias[day(dDate)])->EVN_SUBJ, (aAlias[day(dDate)])->EVN_MEMO ;
FIELDSIZES 30, 120, 220 ;
SIZE 255, 180 ;
PIXEL ;
FONT oFnt2 ;
HEADERS 'Ora', 'Evento', 'Nota' ;
OF oDlg ;
ON DBLCLICK ""
//oDlg:SetControl( oBrw )
oBrw:nStyle := nOR( WS_CHILD,;
WS_BORDER, WS_VISIBLE, WS_TABSTOP )
oBrw:aJustify := { .F., .F., .F. }
if dDate = DATE()
oBrw:nClrForeHead := CLR_WHITE
oBrw:nClrBackHead := CLR_HBLUE
elseif dow(dDate) = 1
oBrw:nClrForeHead := CLR_WHITE
oBrw:nClrBackHead := CLR_RED
elseif dow(dDate) = 7
oBrw:nClrForeHead := CLR_WHITE
oBrw:nClrBackHead := CLR_MAGENTA
else
oBrw:nClrForeHead := CLR_BLACK // oBrw:nClrText
oBrw:nClrBackHead := CLR_WHITE //oBrw:nClrPane
end
oBrw:nLineStyle := 0 // 0 = NONE LINES_V_GRAY // LINES_DOTED // LINES_GRAY
oBrw:nClrPane = CLR_WHITE
oBrw:nClrText = CLR_BLACK
oBrw:nClrBackNotFocus := CLR_WHITE
oBrw:nAt := 1
oBrw:bRClicked := { | nRow, nCol, nFlags | (oBrw:SetFocus(), ;
oBrw:lButtonDown(nRow,nCol), ShowPopup( nRow, nCol, oDlg, oBrw, dDate )) }
oBrw:nClrForeFocus:= CLR_BLACK
oBrw:nClrBackFocus:= CLR_HGRAY // GetSysColor( COLOR_HIGHLIGHT )
ELSE
oBrw := TXBrowse():New( oDlg )
oBrw:nTop := 20
oBrw:nLeft := 0
oBrw:nBottom := oBrw:nTop + 180
oBrw:nRight := oBrw:nLeft + 255
//
oBrw:cAlias := (aAlias[day(dDate)])
//
oBrw:SetFont( oFnt2 )
oBrw:nMarqueeStyle := MARQSTYLE_HIGHLROW
oBrw:nColDividerStyle := LINESTYLE_NOLINES
oBrw:nRowDividerStyle := LINESTYLE_NOLINES
oBrw:lColDividerComplete := .t.
oBrw:nHeaderLines := 1
//oBrw:nHeaderLines := 1
oBrw:nDataLines := 1
oBrw:lFastEdit := .F.
oBrw:lAllowColHiding := .F.
oBrw:lRecordSelector := .F.
oBrw:lVScroll := .F.
oBrw:lHScroll := .F.
//oBrw:bClrHeader := {|| IIF( dDate = DATE(), { CLR_RED, CLR_HBLUE }, { GetSysColor( COLOR_BTNTEXT ), GetSysColor( COLOR_BTNFACE ) } ) }
oBrw:bRClicked := { | nRow, nCol, nFlags | (oBrw:SetFocus(), ;
oBrw:lButtonDown(nRow,nCol), ShowPopup( nRow, nCol, oDlg, oBrw, dDate )) }
// Ora
oCol := oBrw:AddCol()
oCol:cHeader := "Ora"
oCol:bStrData := { || (aAlias[day(dDate)])->EVN_TIME }
oCol:bClrStd := { || Colore( (aAlias[day(dDate)])->EVN_OP ) }
//oCol:bClrHeader := { || IF( art->( ordSetFocus() ) == "UNO", {CLR_WHITE, CLR_RED}, { GetSysColor( COLOR_BTNTEXT ), GetSysColor( COLOR_BTNFACE ) } ) }
//oCol:bRClickData := { || art->( ordSetFocus(1) ), oLbxArt:refresh() }
// Evento
oCol := oBrw:AddCol()
oCol:cHeader := "Evento"
oCol:oHeaderFont := oFnt1
oCol:bStrData := { || (aAlias[day(dDate)])->EVN_SUBJ }
oCol:bClrStd := { || Colore( (aAlias[day(dDate)])->EVN_OP ) }
//oCol:bClrHeader := { || IF( art->( ordSetFocus() ) == "DUE", {CLR_WHITE, CLR_RED}, { GetSysColor( COLOR_BTNTEXT ), GetSysColor( COLOR_BTNFACE ) } ) }
//oCol:bRClickData := { || art->( ordSetFocus(2) ), oLbxArt:refresh() }
// Nota
oCol := oBrw:AddCol()
oCol:cHeader := "Nota"
oCol:oHeaderFont := oFnt1
oCol:bStrData := { || (aAlias[day(dDate)])->EVN_MEMO }
oCol:bClrStd := { || Colore( (aAlias[day(dDate)])->EVN_OP ) }
oBrw:SetRDD()
oBrw:CreateFromCode()
ENDIF
@ 0, 000 BUTTON "Uscita" PIXEL SIZE 64,8 ACTION ( oDlg:end() ) // MostraEventi( @dCal, oDlg ) )
ACTIVATE DIALOG oDlg CENTER
select( cAlias )
return nil
***************
STATIC FUNCTION SelezionaData( dData )
***************
LOCAL oDlg, oDTP, n, lConferma := .F.
LOCAL dTmpData
dTmpData := dData
DEFINE DIALOG oDlg SIZE 240,130 TITLE "Seleziona Data"// OF oWnd
@ 05, 05 SAY "Data " SIZE 30,15 PIXEL
@ 05, 45 DTPicker oDTP Var dTmpData Size 50, 15 Pixel OF oDlg // On Change DTPChange (oDTP)
@ 50,05 BUTTON "Conferma" OF oDlg ACTION ( lConferma := .T., oDlg:end() ) PIXEL
@ 50,70 BUTTON "Uscita" OF oDlg ACTION ( lConferma := .F., oDlg:end() ) PIXEL
ACTIVATE DIALOG oDlg CENTER
IF lConferma
dData :=dTmpData
ENDIF
RETURN lConferma
*
** eof SelezionaData
#define outlookFolderCalendar 9
#define olFolderContacts 10
FUNCTION PrendiDatiOutlook()
LOCAL oOutlook, hApptItem, oNameSpace, ocalendar, hOutlook, ;
lSave := .F., ;
lFOUND := .F., ;
cTxt,;
I := 0, nItems
TRY
CursorWait()
SELECT 0
USE ( oV:arc_dir + "eventi.dat" ) NEW ALIAS eventi SHARED INDEX ( oV:arc_dir + "eventi.ind" )
eventi->( ordSetFocus(2) )
oOutlook := CREATEOBJECT( "Outlook.Application" )
oNameSpace := oOutlook:GetNameSpace("MAPI")
ocalendar := oNameSpace:GetDefaultFolder(outlookFolderCalendar )
FERASE("datiOutlook.txt")
nItems := ocalendar:Items:Count
//msginfo( nItems )
FOR I := 1 TO nItems
//msginfo( VALTYPE( ocalendar:Items[ i ]:START ) )
cTxt := PADR( ocalendar:Items[ i ]:ConversationIndex, 45 ) + " - " + ;
PADR( ocalendar:Items[ i ]:START, 19 ) + " - " +;
PADR( ocalendar:Items[ i ]:END, 19 ) + " - " +;
ocalendar:Items[ i ]:SUBJECT + " - " +;
ocalendar:Items[ i ]:Body
IF !eventi->( dbSeek( PADR( ocalendar:Items[ i ]:ConversationIndex, 45 ) ) )
eventi->( dbAppend() )
REPLACE eventi->evn_idout WITH PADR( ocalendar:Items[ i ]:ConversationIndex, 45 )
REPLACE eventi->evn_date WITH CTOD( PADR( ocalendar:Items[ i ]:START, 10 ) )
REPLACE eventi->evn_time WITH RIGHT( PADR( ocalendar:Items[ i ]:START, 19 ), 8 )
REPLACE eventi->evn_subj WITH ocalendar:Items[ i ]:SUBJECT
REPLACE eventi->evn_memo WITH ocalendar:Items[ i ]:BODY
REPLACE eventi->evn_op WITH cOperatore
ENDIF
//01C868AF1EC46949DA0314C440AA9FE7C122E63FE176 - 06/02/2008 18:59:59 - 06/02/2008 19:30:00 - PROVA PROVA PROVA 06-02-2008 - PROVA DI TESTO...
InfStat( cTxt )
WriteInfoTxt( cTxt, , "datiOutlook.txt", .T. )
/*
IF DTOS(ocalendar:Items[ i ]:START) = DTOS(CTOD(CDATE)) .AND. ocalendar:Items[ i ]:SUBJECT = cObjet ;
.AND. ocalendar:Items[ i ]:Body = cNote .AND. ocalendar:Items[ i ]:Duration = NLeninmin
LFOUND := TRUE
I := 1000000
ENDIF
*/
NEXT
OOutlook := NIL
lSave := .t.
CATCH
lSave := .f.
END
eventi->( dbCloseArea() )
CursorArrow()
RETURN NIL
*
**
*
***************
STATIC FUNCTION Colore( cOp )
***************
LOCAL nVal := VAL( cOp )
LOCAL aColor := { CLR_BLACK, GetSysColor( COLOR_WINDOW ) }
IF nVal = 0
aColor := { CLR_RED, GetSysColor( COLOR_WINDOW ) }
ELSEIF nVal = 1
aColor := { CLR_BLUE, GetSysColor( COLOR_WINDOW ) }
ELSEIF nVal = 2
aColor := { CLR_GREEN, GetSysColor( COLOR_WINDOW ) }
ELSEIF nVal = 3
aColor := { RGB( 0, 128, 128 ), GetSysColor( COLOR_WINDOW ) }
ELSEIF nVal = 4
aColor := { CLR_HRED, GetSysColor( COLOR_WINDOW ) }
ELSEIF nVal = 5
aColor := { CLR_CYAN, GetSysColor( COLOR_WINDOW ) }
ELSEIF nVal = 6
aColor := { CLR_BROWN, GetSysColor( COLOR_WINDOW ) }
ELSEIF nVal = 7
aColor := { RGB( 193, 97, 0 ), GetSysColor( COLOR_WINDOW ) }
ELSEIF nVal = 8
aColor := { CLR_MAGENTA, GetSysColor( COLOR_WINDOW ) }
ELSEIF nVal = 9
aColor := { RGB( 64, 128, 128 ), GetSysColor( COLOR_WINDOW ) }
ELSE
aColor := { CLR_HMAGENTA, GetSysColor( COLOR_WINDOW ) }
ENDIF
RETURN aColor
*
** eof Colore
********
FUNCTION ApriEventi()
********
IF !FILE( oV:arc_dir + "eventi.dat" )
DBCREATE( oV:arc_dir + "eventi.dat", {;
{ "EVN_DATE" , "D", 8, 0 },;
{ "EVN_TIME" , "C", 5, 0 },;
{ "EVN_SUBJ" , "C", 20, 0 },;
{ "EVN_IDOUT", "C", 45, 0 },;
{ "EVN_OP" , "C", 2, 0 },;
{ "EVN_MEMO" , "M", 10, 0}})
ENDIF
IF !FILE( oV:arc_dir + "eventi.ind" )
SELECT 0
USE ( oV:arc_dir + "eventi.dat" ) NEW ALIAS eventi EXCLUSIVE
INDEX ON DTOS( FIELD->EVN_DATE ) + FIELD->EVN_TIME TAG uno TO ( oV:arc_dir + "eventi.ind" )
INDEX ON FIELD->EVN_IDOUT TAG due TO ( oV:arc_dir + "eventi.ind" )
USE
ENDIF
IF select("eventi") = 0
select 0
USE ( oV:arc_dir + "eventi.dat" ) INDEX ( oV:arc_dir + "eventi.ind" ) ALIAS "eventi" SHARED NEW
ENDIF
RETURN .T.
*
** eof ApriEventi
*
***************
STATIC FUNCTION CambiaMese( oDlg, nValore, oMeseAnno, dDataChg )
***************
LOCAL n, z
LOCAL x := 0
//( IIF( MONTH( dCal ) = 12, dCal := CTOD( "01/01/" + NTRIM( YEAR( dCal) + 1 ) ), dCal := CTOD( "01/" + NTRIM( MONTH( dCal ) + 1 ) + "/" + NTRIM( YEAR( dCal) ) ) ), oDlg:end(), Eventi( dCal ) )
IF !EMPTY( dDataChg )
//dCal := CTOD( "01/" + NTRIM( MONTH( dCal ) ) + "/" + NTRIM( YEAR( dCal ) ) )
//dCal è gia cambiata...
ELSEIF nValore > 0
dCal := CTOD( "01/" + NTRIM( MONTH( dCal ) ) + "/" + NTRIM( YEAR( dCal ) ) )
IF MONTH( dCal ) = 12
dCal := CTOD( "01/01/" + NTRIM( YEAR( dCal) + 1 ) )
ELSE
dCal := CTOD( "01/" + NTRIM( MONTH( dCal ) + 1 ) + "/" + NTRIM( YEAR( dCal) ) )
ENDIF
ELSE
dCal := CTOD( "01/" + NTRIM( MONTH( dCal ) ) + "/" + NTRIM( YEAR( dCal ) ) )
dCal := dCal - 1
ENDIF
oMeseAnno:varput( CMESE( dCal ) + " " + NTRIM( YEAR( dCal ) ) )
oMeseAnno:refresh()
AEVAL( oBrw, {|x| IIF( !EMPTY( x ), x:end(), "" ) } )
/*
FOR n := 1 TO LEN( oBrw )
IF !EMPTY( oBrw[n] )
oBrw[n]:end()
ENDIF
NEXT
*/
/*
FERASE( "class.txt" )
FOR z := 1 TO LEN( oDlg:aControls )
WriteInfoTxt( PADR( oDlg:aControls[z]:ClassName(), 50 ) + NTRIM( z ), , "class.txt", .T. )
IF oDlg:aControls[z]:oWnd:ClassName() = "TXBROWSE"
oDlg:aControls[z]:destroy()
ENDIF
NEXT
*/
MostraEventi( dCal, oDlg )
RETURN NIL
*
** eof CambiaMese
Return to FiveWin para Harbour/xHarbour
Users browsing this forum: Google [Bot], JoseLuis and 79 guests