TUTOR04.PRG modificado con MEMVAR
Code: Select all
#include "FiveWin.ch"
static oWnd
//----------------------------------------------------------------------------//
function Main()
local oIco, oBar, oBmp
MEMVAR MYMEMVAR1, MYMEMVAR2, MYMEMVAR3
MYMEMVAR1 := "SOY MEMVAR 1"
MYMEMVAR2 := "SOY MEMVAR 2"
MYMEMVAR3 := "SOY MEMVAR 3"
? MYMEMVAR1, MYMEMVAR2, MYMEMVAR3
DEFINE ICON oIco FILE "..\icons\fax.ico"
DEFINE WINDOW oWnd FROM 1, 1 TO 22, 75 ;
TITLE "FiveWin sample" ;
MENU BuildMenu() ;
COLOR "B/W" ;
ICON oIco
DEFINE BUTTONBAR oBar _3D SIZE 26, 27 OF oWnd
DEFINE BUTTON OF oBar FILENAME "C:\FWH1306\bitmaps\16x16\new.bmp" FLAT ;
ACTION MsgInfo( "New" ) ;
TOOLTIP "Creates a new document"
DEFINE BUTTON OF oBar FILENAME "C:\FWH1306\bitmaps\16x16\open.bmp" FLAT ;
ACTION MsgInfo( cGetFile( "*.*", "Select a document to open" ) ) ;
TOOLTIP "Opens a document" WHEN .f.
DEFINE BUTTON OF oBar FILENAME "C:\FWH1306\bitmaps\16x16\floppy.bmp" FLAT ;
ACTION MsgInfo( Time() ) TOOLTIP "Saves this document"
DEFINE BUTTON OF oBar FILENAME "C:\FWH1306\bitmaps\16x16\printer.bmp" FLAT ;
ACTION MsgInfo( "Prints this document" ) TOOLTIP "Print this document" GROUP
// XXXX - gerando um erro - generando un error
DEFINE BUTTON OF oBar FILENAME "C:\FWH1306\bitmaps\16x16\prop.bmp" FLAT ;
ACTION PrinterSetup() TOOLTIP "Setup the printer"
DEFINE BUTTON OF oBar FILENAME "C:\FWH1306\bitmaps\16x16\HelpInd.bmp" FLAT ;
ACTION MsgInfo( Version() ) TOOLTIP "A multiple lines" + ;
Chr( 13 ) + Chr( 10 ) + "tooltip!" GROUP
DEFINE BUTTON OF oBar FILENAME "C:\FWH1306\bitmaps\16x16\Help.bmp" FLAT ;
ACTION MsgInfo( "fivewin power!" ) TOOLTIP "fivewin power!"
DEFINE BUTTON OF oBar FILENAME "C:\FWH1306\bitmaps\16x16\Exit.bmp" FLAT ;
ACTION oWnd:End() TOOLTIP "Exit this app" GROUP
DEFINE MESSAGE OF oWnd ;
PROMPT FWVERSION + " " + FWCOPYRIGHT ;
NOINSET CENTERED KEYBOARD DATE CLOCK
DEFINE BITMAP oBmp FILENAME "C:\FWH1306\bitmaps\fiveback.bmp"
oWnd:bPainted = { | hDC | BmpTiled( hDC, oWnd, oBmp ) }
ACTIVATE WINDOW oWnd ;
VALID MsgYesNo( "Do you want to quit ?" )
return nil
//----------------------------------------------------------------------------//
function BuildMenu()
local oMenu
? MYMEMVAR1, MYMEMVAR2, MYMEMVAR3
MENU oMenu
MENUITEM "Information"
MENU
MENUITEM "&About..." ;
ACTION MsgInfo( FWDESCRIPTION ) ;
FILENAME "C:\FWH1306\bitmaps\16x16\info.bmp"
SEPARATOR
MENUITEM "&End..." ;
ACTION oWnd:End() FILENAME "C:\FWH1306\bitmaps\16x16\exit.bmp"
ENDMENU
MENUITEM "&Clients"
MENU
MENUITEM "&New..." ;
ACTION ( MsgStop( "New Clients" ),;
oWnd:Say( 5, 5, "New Clients...", "GR+/G" ) ) ;
FILENAME "C:\FWH1306\bitmaps\16x16\faces.bmp"
MENUITEM "&Modify..." ACTION MsgInfo( "Modif. Clients" ) ;
FILENAME "C:\FWH1306\bitmaps\edit.bmp"
MENUITEM "&Delete..." ACTION MsgAlert( "Del Clients" ) ;
FILENAME "C:\FWH1306\bitmaps\16x16\delete.bmp"
SEPARATOR
MENUITEM "&Browse..." ACTION MsgInfo( "Browse Clients" ) ;
FILENAME "C:\FWH1306\bitmaps\16x16\browse.bmp"
ENDMENU
MENUITEM "&Utilities"
MENU
MENUITEM "&Calculator..." ACTION WinExec( "Calc" ) ;
FILENAME "C:\FWH1306\bitmaps\16x16\calc.bmp"
MENUITEM "&Internet..." ;
ACTION WinExec( "start iexplore www.fivetech.com", 0 ) ;
FILENAME "C:\FWH1306\bitmaps\16x16\explorer.bmp"
ENDMENU
ENDMENU
return oMenu
//----------------------------------------------------------------------------//
STATIC FUNCTION BmpTiled( hDC, oWnd, oBmp )
local nWidth := oWnd:nWidth(), nHeight := oWnd:nHeight()
local nRow := 0, nCol := 0, n
local nBmpWidth := oBmp:nWidth(), nBmpHeight := oBmp:nHeight()
? MYMEMVAR1, MYMEMVAR2, MYMEMVAR3
if oBmp:hBitmap == 0
return nil
endif
while nRow < nHeight
nCol = 0
while nCol < nWidth
PalBmpDraw( hDC, nRow, nCol, oBmp:hBitmap )
nCol += nBmpWidth
end
nRow += nBmpHeight
end
return nil
//----------------------------------------------------------------------------//
Saludos.