[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
It's time to add a menu. Here's SOURCE\CMD\APP3.PRG (APP2.PRG
is the same, but omits the browse):
#include "windows.ch"
#define NO_C4WCLASS
#include "commands.ch"
function main()
local oApp, hWnd
USE users NEW SHARED
CREATE APPLICATION oApp WINDOW hWnd ;
TITLE "Clip-4-Win Makes Windows Apps E-A-S-Y!" ;
ON INIT MenuSetup(hWnd)
return nil
static function MenuSetup(hWnd)
MENU IN hWnd
POPUP "&File"
MENUITEM "&Browse" ACTION WBrowseDef()
MENUITEM SEPARATOR
MENUITEM "E&xit" ACTION PostQuitMessage(0)
ENDPOPUP
POPUP "&Help"
MENUITEM "&About" ;
ACTION MessageBox( , "Easy!", "Clip-4-Win App")
ENDPOPUP
ENDMENU
return nil
From the CLIP4WIN\SOURCE\CMD directory, this example can be
built rather like the last:
C4WBUILD APP3
Try running APP3.EXE - it should let you browse the USERS.DBF file.
You may be aware that Clip-4-Win has quite a number of
functions relating to menus and menu items. As you might
expect, the above menu translates into functions which
ultimately call the underlying menu ones. If you prefer to
use the menu functions directly, go ahead - there are plenty
of samples to show you how (and APP.PRG even shows both).
The above syntax was chosen to be close to the "standard" used
in resource files; these files are introduced in the next
section ("Simple Data Entry Application").
NOTE:
If you're familiar with DBrowse (dialog browse), there's a
version of APP3 which uses it - see APP3D.PRG. You can build
it using: C4WBUILD APP3D. Don't be surprised at the extra
steps performed: this is a little more trouble for C4WBUILD.BAT
to build, because the source to the DBrowse() function is
supplied - and can be compiled in more than one way.
Online resources provided by: http://www.ClipX.Net --- NG 2 HTML conversion by Dave Pearson