I made this testout.prg
Code: Select all
// FWH Class TOutLook2003
#include "FiveWin.ch"
#include "Splitter.ch"
// LockType
#define adLockUnspecified -1
#define adLockReadOnly 1
#define adLockPessimistic 2
#define adLockOptimistic 3
#define adLockBatchOptimistic 4
// CursorType
#define adOpenUnspecified 1
#define adOpenForwardOnly 0
#define adOpenKeyset 1
#define adOpenDynamic 2
#define adOpenStatic 3
// Cursor Location
#define adUseClient 3
#define adUseServer 2
// State constants
#define adStateClosed 0 //The object is closed
#define adStateOpen 1 //The object is open
static lExit := .F.
STATIC oDb, oSc, oCt
//----------------------------------------------------------------------------//
function Main()
local oWnd, oOutLook2003, oStatusBar, oSplit, cCombo, oRad, nValue := 1
local oFont,oTree,oBar
DEFINE WINDOW oWnd TITLE "FWH new Class TOutLook2003" MDI ;
MENU BuildMenu()
DEFINE BUTTONBAR oBar _3D SIZE 44, 46 OF oWnd 2007 //36, 40
DEFINE OUTLOOK2003 oOutLook2003 OF oWnd ;
PROMPTS "Categorie", "Prodotti", "Utenti", "Tabelle" ;
BITMAPS "..\bitmaps\mail.bmp", "..\bitmaps\calendar.bmp", "..\bitmaps\notes.bmp"
oWnd:oLeft = nil // Because the splitter is going to control the resize
@ 1, 2 BUTTON "New" OF oOutLook2003:aDialogs[ 1 ] SIZE 80, 22 ACTION BuildDlg()
@ 3, 2 BUTTON "Edit" OF oOutLook2003:aDialogs[ 1 ] SIZE 80, 22 ACTION MsgInfo( "Edit" )
@ 5, 2 BUTTON "Search" OF oOutLook2003:aDialogs[ 1 ] SIZE 80, 22 ACTION MsgInfo( "Search" )
@ 1, 1 COMBOBOX cCombo ITEMS { "January", "February", "March", "April", "May" } ;
OF oOutLook2003:aDialogs[ 2 ] SIZE 170, 100
DEFINE FONT oFont NAME "Arial" SIZE 0, -10
@ 12, 10 SAY Date() OF oOutLook2003:aDialogs[ 2 ] SIZE 80, 20 FONT oFont
@ 3, 1 RADIO oRad VAR nValue OF oOutLook2003:aDialogs[ 2 ] ;
ITEMS "&Day", "&Week", "&Month" SIZE 100, 20
oRad:SetFont( oFont )
SET MESSAGE OF oWnd TO "FW OUTLOOK 2003 TEST" CENTER NOINSET 2007
SetParent( oOutLook2003:hWnd, oWnd:hWnd )
oWnd:oClient = nil
ConnectToDataBase()
IF oDb != NIL .AND. oDb:State == adStateOpen
IF OpenTables()
@ 00, 191+5 TREEVIEW oTree SIZE oWnd:nRight, oWnd:nBottom PIXEL OF oWnd:oWndClient
ENDIF
ENDIF
@ 0, 191 SPLITTER oSplit ;
VERTICAL _3DLOOK ;
PREVIOUS CONTROLS oOutLook2003 ;
HINDS CONTROLS oWnd:oWndClient ;
SIZE 4, oWnd:nHeight - 70 PIXEL ;
OF oWnd
SetParent( oSplit:hWnd, oWnd:hWnd )
ACTIVATE WINDOW oWnd ;
ON INIT MakeTree( oTree ) ;
ON RESIZE (oSplit:Adjust(),oTree:refresh(.t.)) ;
VALID lExit := .T.
return nil
//----------------------------------------------------------------------------//
STATIC FUNCTION MakeTree( oTree )
LOCAL oItem
oSc:MoveFirst()
DO WHILE !oSc:Eof()
oItem := oTree:Add( oSc:Fields( "SCategoria" ):Value )
oItem:Cargo := oSc:Fields( "ID" ):Value
oCt:Filter := "SCATEGORIA = " + LTRIM( STR( oSc:Fields( "ID" ):Value ) )
IF oCt:RecordCount() > 0
oCt:MoveFirst()
DO WHILE !oCt:Eof()
oItem:Add( oCt:Fields( "Categoria" ):Value,, oCt:Fields( "ID" ):Value )
oCt:MoveNext()
ENDDO
ENDIF
oSc:MoveNext()
ENDDO
oTree:ExpandAll()
oCt:Filter := ""
oSc:MoveFirst()
oCt:MoveFirst()
SetScope()
RETURN .T.
STATIC FUNCTION SetScope()
oCt:Filter := "SCATEGORIA = " + LTRIM( STR( oSc:Fields( "ID" ):Value ) )
IF oCt:RecordCount() > 0
oCt:MoveFirst()
ENDIF
RETURN NIL
function BuildMenu()
local oMenu
MENU oMenu 2007
MENUITEM "&One"
MENUITEM "&Two"
MENUITEM "&Three"
ENDMENU
return oMenu
//----------------------------------------------------------------------------//
function BuildDlg()
local oDlg, oOutL2003
DEFINE DIALOG oDlg RESOURCE "Test"
REDEFINE OUTLOOK2003 oOutL2003 ID 110 OF oDlg ;
PROMPTS "One", "Two", "Three" ;
BITMAPS "..\bitmaps\mail.bmp", "..\bitmaps\calendar.bmp", "..\bitmaps\notes.bmp" ;
DIALOGS "Page1", "Page2", "Page3"
REDEFINE BUTTON ID 110 OF oOutL2003:aDialogs[ 1 ] ACTION MsgInfo( "Click" )
ACTIVATE DIALOG oDlg CENTERED
return nil
//----------------------------------------------------------------------------//
function WinRun()
while NoGPF()
if lExit
PostQuitMessage( 0 )
endif
end
return nil
//----------------------------------------------------------------------------//
#pragma BEGINDUMP
#include <windows.h>
#include <hbapi.h>
BOOL SysRefresh( void );
HB_FUNC( NOGPF )
{
__try
{
hb_retl( SysRefresh() );
}
__except ( ( hb_retl( TRUE ), TRUE ) )
{}
}
#pragma ENDDUMP
STATIC FUNCTION ConnectToDataBase
oDB := TOLEAuto():New( "ADODB.Connection" )
oDB:ConnectionString := "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=ecom.mdb;User Id=admin;Password=;"
oDB:CursorLocation := adUseClient
TRY
oDB:Open()
CATCH
oDB := NIL
MsgInfo('Connect Fail')
RETURN NIL
END
RETURN oDB
//----------------------------------------------------------------------------//
STATIC FUNCTION OpenTables
oSc := TOLEAuto():New( "ADODB.RecordSet" )
WITH OBJECT oSc
:ActiveConnection := oDB
:CursorType := adOpenDynamic
:LockType := adLockOptimistic
:Source := "SCATEGORIE"
:CursorLocation := adUseClient
END
TRY
oSc:Open()
CATCH
oSc := NIL
MsgInfo( "ATTENZIONE - Non posso aprire la tabella SCATEGORIE" )
END
oCt := TOLEAuto():New( "ADODB.RecordSet" )
WITH OBJECT oCt
:ActiveConnection := oDB
:CursorType := adOpenDynamic
:LockType := adLockOptimistic
:Source := "CATEGORIE"
:CursorLocation := adUseClient
END
TRY
oCt:Open()
CATCH
oCt := NIL
MsgInfo( "ATTENZIONE - Non posso aprire la tabella CATEGORIE" )
END
IF oSc != NIL .AND. oCt != NIL
RETURN .T.
ENDIF
RETURN .F.
Now I see the tree always
but I wanted click on "categorie" menu of outlook 2003 and see the treeview
or
click on "utenti" menu of of outlook 2003 and see and see a Xbrowse with utenti
how I can make it ?