How to paint non modal dialogs using OutLook2003 Class

How to paint non modal dialogs using OutLook2003 Class

Postby RAMESHBABU » Sun Oct 05, 2008 5: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
User avatar
RAMESHBABU
 
Posts: 614
Joined: Fri Oct 21, 2005 5:54 am
Location: Secunderabad (T.S), India

Postby Antonio Linares » Sun Oct 05, 2008 10:47 pm

Ramesh,

Here you have a working example:
Code: Select all  Expand view
#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
User avatar
Antonio Linares
Site Admin
 
Posts: 41315
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby RAMESHBABU » Mon Oct 06, 2008 6:33 am

Mr.Antonio

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

Thanks once again

- Ramesh Babu P
User avatar
RAMESHBABU
 
Posts: 614
Joined: Fri Oct 21, 2005 5:54 am
Location: Secunderabad (T.S), India


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Otto and 82 guests