outlook 2003 test

Post Reply
User avatar
Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

outlook 2003 test

Post by Silvio »

I want when I click one menu of outlook2003 see a tree or a xbrowse

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 ?
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Post by Silvio »

you have my file ecom ?
do you remeber of it ?
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Post by Silvio »

I cannot create a self.... because there is many table and data....
ansd i not Know how I can make to you this sample

BUT it is not important

you can use an your own file MDB or dbf

th eproblem is another here!!!
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Post by Silvio »

i want only know the command to show a xbrowse or a another object at th left of the main window when I clich a menu of TOUTLOOK2003

perhaps you not read goo my messages


sorry,..
Best Regards, Saludos

Falconi Silvio
User avatar
ukoenig
Posts: 3981
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany
Contact:

Structure of Outlook2003

Post by ukoenig »

Hello Silvio,

There are 2 Window-Childs : one obove the Buttons
and 1 you have on the righthandside.
Do you want to show on left or right ?
I prefer the right side. The chhilds above the
buttons, i use for messages.

I can make you a ready to use structure file,
where you can put your functions. As well,
there are Office2007-Bars integreated.
It comes from the new DB-Tools, where everything
comes together.
It is a bit hard, to understand.

Image

Regards
Uwe
Last edited by ukoenig on Thu Feb 14, 2008 12:23 pm, edited 1 time in total.
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Post by Silvio »

dear Uwe
i want show treeview object on the left of oWnd when I click on "Categorie", i wan tshow a xbrowse on the left of oWnd when I click on "Utenti

when i open the program the application must see the outlook2003 on the right and a bitmap on the background on the left

i hope you understand me
Best Regards, Saludos

Falconi Silvio
Post Reply