Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- FiveWin 1.9.2 - January 97 - // in this exercise we are going to build dialog boxes directly from http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
// In this exercise we are going to build Dialog Boxes directly from
// our program. In next exercises we will review how to build them using
// a resource editor.

#include "FiveWin.ch"

static oWnd

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

function Main()

   SET 3DLOOK ON

   DEFINE WINDOW oWnd FROM 1, 1 TO 22, 75 ;
      TITLE "Building a DialogBox" ;
      MENU  BuildMenu()

   SET MESSAGE OF oWnd ;
      TO FWVERSION + ", " + FWCOPYRIGHT CENTERED TIME DATE

   ACTIVATE WINDOW oWnd MAXIMIZED

return nil

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

function BuildMenu()

   local oMenu

   MENU oMenu
      MENUITEM "&Information"
      MENU
         MENUITEM   "&About..." ;
            ACTION  MsgInfo( "FiveWin Tutorial" + Chr( 13 ) + FWCOPYRIGHT ) ;
            MESSAGE "Information about this application"

         SEPARATOR

         MENUITEM   "&End..."  ;
            ACTION  If( MsgYesNo( "Want to end ?" ), oWnd:End(),) ;
            MESSAGE "End this application"
      ENDMENU

      MENUITEM "&Files"
      MENU
         MENUITEM   "&Customers..." ;
            ACTION  Customers() ;
            MESSAGE "Customers maintainance"

         MENUITEM   "&Stock" ;
            ACTION  MsgInfo( "Place your Stock control here" ) ;
            MESSAGE "Stock control"
      ENDMENU

      MENUITEM "&Utils"
      MENU
         MENUITEM   "&Calculator..." ;
            ACTION  WinExec( "Calc" ) ;
            MESSAGE "Run Windows calculator"

         MENUITEM   "C&alendar..." ;
            ACTION  WinExec( "Calendar" ) ;
            MESSAGE "Run Windows calendar"

         MENUITEM "&File..." ;
            ACTION WinExec( "CardFile" ) ;
            MESSAGE "Run Windows file"
      ENDMENU
   ENDMENU

return oMenu

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

function Customers()

   local oDlg
   local cNombre := "This is the name of my customer      "
   local lUsaFiveWin := .t.
   local numero := 0

   DEFINE DIALOG oDlg FROM 6, 7 TO 21, 72 ;
      TITLE "Customers maintanance"

   @ 1,  2 SAY "Name:" OF oDlg
   @ 1,  8 GET cNombre  OF oDlg
   @ 3,  2 CHECKBOX lUsaFiveWin PROMPT "Use Clipper && FiveWin" OF oDlg
   @ 5,  8 GET numero PICTURE "99.99" OF oDlg

   @ 8,  3 BUTTON "&Previous"  OF oDlg SIZE 50, 12 ACTION MsgInfo( "Previous" )
   @ 8, 14 BUTTON "&Next"      OF oDlg SIZE 50, 12 ACTION MsgInfo( "Next" )
   @ 8, 26 BUTTON "&End"       OF oDlg SIZE 50, 12 ACTION oDlg:End()

   ACTIVATE DIALOG oDlg

return nil

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

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson