
udc.prg
Code: Select all | Expand
#include "FiveWin.ch"function Main() local oDlg, oGet, oFont local cUDC, cTest, cResult := Space( 500 ) DEFINE FONT oFont NAME "Courier New" SIZE 0, -16 cUDC = PadR( "RENAME DATAFIELD <x> AS <y> ALIAS <a> => " + ; "<a>->( DbFieldInfo( DBS_ALIAS, FieldPos( <x> ), <y> ) )", 500 ) cTest := PadR( 'RENAME DATAFIELD "class" AS "_class" ALIAS Test', 500 ) SetDlgGradient( { { 1, RGB( 199, 216, 237 ), RGB( 237, 242, 248 ) } } ) DEFINE DIALOG oDlg TITLE "UDC Tester" ; SIZE 500, 500 @ 1, 1.5 SAY "UDC" OF oDlg SIZE 80, 8 @ 2, 1 GET oGet VAR cUDC MEMO SIZE 235, 50 FONT oFont oGet:bGotFocus = { || oGet:SetSel( 0, 0 ) } @ 5.5, 1.5 SAY "Test code" OF oDlg SIZE 80, 8 @ 7.2, 1 GET cTest MEMO SIZE 235, 50 FONT oFont @ 10, 1.5 SAY "Resulting code" OF oDlg SIZE 80, 8 @ 12.5, 1 GET cResult MEMO SIZE 235, 50 UPDATE FONT oFont @ 12.5, 5 BUTTON "Save" OF oDlg SIZE 45, 13 @ 12.5, 17 BUTTON "Test" OF oDlg SIZE 45, 13 ; ACTION ( Test( cUDC, cTest, @cResult ), oDlg:Update() ) @ 12.5, 29 BUTTON "Exit" OF oDlg SIZE 45, 13 ACTION oDlg:End() ACTIVATE DIALOG oDlg CENTERED oFont:End()return nilfunction Test( cUDC, cTest, cResult ) local hPP := __pp_init() if ! __pp_addRule( hPP, "#xcommand " + AllTrim( cUDC ) ) MsgAlert( "Error in UDC" ) return nil endif cResult = __pp_process( hPP, AllTrim( cTest ) ) return nil

Source code and EXE:
http://code.google.com/p/fivewin-contributions/downloads/detail?name=udc.zip&can=2&q=