FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour How to paint non modal dialogs using OutLook2003 Class
Posts: 654
Joined: Fri Oct 21, 2005 05:54 AM
How to paint non modal dialogs using OutLook2003 Class
Posted: Sun Oct 05, 2008 05:39 AM

Hi

I am trying to have an interface using OUTLOOK2003 Class. What I need is, when I click
on any one of the buttons like "Mail", "Calendar" or "Contacts", a nonmodal dialog having
some controls painted on it should popup on the client area of the window. And the nonmodal
dialog should be closed or hidden automatically when I click on any other button on the
OutLook2003.

Can anybody guide me who to accomplish this.

Thanks

  • Ramesh Babu P
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
How to paint non modal dialogs using OutLook2003 Class
Posted: Sun Oct 05, 2008 10:47 PM
Ramesh,

Here you have a working example:
#include "FiveWin.ch"
#include "Splitter.ch"

static lExit := .F.

//----------------------------------------------------------------------------//

function Main()

   local oWnd, oOutLook2003, oStatusBar, oSplit, cCombo, oRad, nValue := 1
   local oFont

   DEFINE WINDOW oWnd TITLE "FWH new Class TOutLook2003" MDI // ;
      // MENU BuildMenu()

   DEFINE OUTLOOK2003 oOutLook2003 OF oWnd ;
      PROMPTS "Mail", "Calendar", "Contacts", "" ;
      BITMAPS "..\bitmaps\mail.bmp", "..\bitmaps\calendar.bmp", "..\bitmaps\notes.bmp"
      
   oOutLook2003:bChange = { | n, nPrevious | ShowDialog( n, nPrevious, oWnd ) }   

   ShowDialog( 1, 2, oWnd )
      
   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 )   

   #ifndef __CLIPPER__
      DEFINE STATUSBAR oStatusBar PROMPT "  FWH Class TOutLook2003" OF oWnd
   #else   
      DEFINE MESSAGE oStatusBar PROMPT "  FWH Class TOutLook2003" OF oWnd
   #endif   

   SetParent( oOutLook2003:hWnd, oWnd:hWnd )
   
   oWnd:oClient = nil
   
   @ 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 RESIZE ( oSplit:Adjust(), WndLeft( oWnd:oWndClient:hWnd, oSplit:nRight + 1 ) ) ;
      VALID lExit := .T.

return nil

//----------------------------------------------------------------------------//

function BuildMenu()

   local oMenu
   
   MENU oMenu
      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	

//----------------------------------------------------------------------------//

function ShowDialog( n, nPrevious, oWnd )

   static aDlgs
   
   if aDlgs == nil
      aDlgs = Array( 3 )
      
      DEFINE DIALOG aDlgs[ 1 ] TITLE "Dialog 1"
      
      ACTIVATE DIALOG aDlgs[ 1 ] NOWAIT
      
      aDlgs[ 1 ]:Hide()
      SetParent( aDlgs[ 1 ]:hWnd, oWnd:oWndClient:hWnd )
         
      DEFINE DIALOG aDlgs[ 2 ] TITLE "Dialog 2"
      
      ACTIVATE DIALOG aDlgs[ 2 ] NOWAIT 
      
      aDlgs[ 2 ]:Hide()
      SetParent( aDlgs[ 2 ]:hWnd, oWnd:oWndClient:hWnd )
         
      DEFINE DIALOG aDlgs[ 3 ] TITLE "Dialog 3"
      
      ACTIVATE DIALOG aDlgs[ 3 ] NOWAIT
      
      aDlgs[ 3 ]:Hide()
      SetParent( aDlgs[ 3 ]:hWnd, oWnd:oWndClient:hWnd )
   endif      

   aDlgs[ nPrevious ]:Hide()
   aDlgs[ n ]:Show()
   
return nil         

//----------------------------------------------------------------------------//
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 654
Joined: Fri Oct 21, 2005 05:54 AM
How to paint non modal dialogs using OutLook2003 Class
Posted: Mon Oct 06, 2008 06:33 AM

Mr.Antonio

Thank you very much. Your solution has helped me alot.

Thanks once again

  • Ramesh Babu P

Continue the discussion