New FiveForm.prg in FWH 12.07
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
New FiveForm.prg in FWH 12.07
samples\FiveForm.prg is a FWH forms (windows, dialogs) designer that automatically
generates PRG source code and allows the save and load of forms to disk. It is a
work in progress that we will be completing in next FWH builds, so your feedback is
very welcome
FiveForm.prg requires FWH 12.07 as we have implemented new required Methods GenLocals()
and cGenPrg() so it can work properly. Also, FiveWin.ch has been modified so now all
controls created from source code save their variable names into the DATA cVarName.
In example, if you do: @ ..., ... GET oGet1 VAR ...
oGet1:cVarName will be automatically assigned with "oGet1".
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: New FiveForm.prg in FWH 12.07
This is an example of an automatically generated source code from FiveForm.prg:
Code: Select all
#include "FiveWin.ch"
//----------------------------------------------------------------------------//
function BuildWindow()
local oForm1, oSay1, oGet1, cGet1 := Space( 20 ), oBtn1, oBtn2, oChk1, lChk1 := .F.
DEFINE WINDOW oForm1 TITLE "Form1" ;
FROM 21, 61 TO 36, 116
@ 48, 80 SAY oSay1 PROMPT "Say" SIZE 56, 16 PIXEL OF oForm1
@ 48, 160 GET oGet1 VAR cGet1 SIZE 120, 24 PIXEL OF oForm1
@ 136, 72 BUTTON oBtn1 PROMPT "Button" ;
SIZE 82, 26 PIXEL OF oForm1 ;
ACTION MsgInfo( "Not defined yet!" )
@ 136, 192 BUTTON oBtn2 PROMPT "Button" ;
SIZE 82, 26 PIXEL OF oForm1 ;
ACTION MsgInfo( "Not defined yet!" )
@ 96, 136 CHECKBOX oChk1 VAR lChk1 PROMPT "Checkbox" SIZE 83, 27 PIXEL OF oForm1
ACTIVATE WINDOW oForm1
return oForm1
//----------------------------------------------------------------------------//
Re: New FiveForm.prg in FWH 12.07
nice... remember on the dialogs it change the coordinates we must rewrite all cGenprg methods for each control class
sample for tbtnbmp
METHOD cGenPRG(lDlgUnits) CLASS TBtnBmp
local cPrg := ""
local nFactorX, nFactorY
local cTop, cLeft, cWidth, cHeight
DEFAULT lDlgUnits := .F.
nFactorX = If( lDlgUnits, 4 / nLoWord( GetDlgBaseUnits() ), 1 )
nFactorY = If( lDlgUnits, 8 / nHiWord( GetDlgBaseUnits() ), 1 )
::CoorsUpdate()
cTop = LTrim( Str( Int( ::nTop * nFactorX ) ) )
cLeft = LTrim( Str( Int( ::nLeft * nFactorY ) ) )
cWidth = LTrim( Str( Int( ::nWidth * nFactorY ) ) )
cHeight = LTrim( Str( Int( ::nHeight * nFactorX ) ) )
cPrg += CRLF + " @ " + cTop + ", " + cLeft + ;
' BTNBMP oBtn PROMPT "' + ::cCaption + '" SIZE ' + ;
cWidth + ", " + cHeight + ;
" PIXEL OF oWnd ;" + CRLF + ;
' ACTION MsgInfo( "Not defined yet!" )' + CRLF
return cPrg
sample for tbtnbmp
METHOD cGenPRG(lDlgUnits) CLASS TBtnBmp
local cPrg := ""
local nFactorX, nFactorY
local cTop, cLeft, cWidth, cHeight
DEFAULT lDlgUnits := .F.
nFactorX = If( lDlgUnits, 4 / nLoWord( GetDlgBaseUnits() ), 1 )
nFactorY = If( lDlgUnits, 8 / nHiWord( GetDlgBaseUnits() ), 1 )
::CoorsUpdate()
cTop = LTrim( Str( Int( ::nTop * nFactorX ) ) )
cLeft = LTrim( Str( Int( ::nLeft * nFactorY ) ) )
cWidth = LTrim( Str( Int( ::nWidth * nFactorY ) ) )
cHeight = LTrim( Str( Int( ::nHeight * nFactorX ) ) )
cPrg += CRLF + " @ " + cTop + ", " + cLeft + ;
' BTNBMP oBtn PROMPT "' + ::cCaption + '" SIZE ' + ;
cWidth + ", " + cHeight + ;
" PIXEL OF oWnd ;" + CRLF + ;
' ACTION MsgInfo( "Not defined yet!" )' + CRLF
return cPrg
Re: New FiveForm.prg in FWH 12.07
You can use AUTOCODE to edit the generated code.
Best regards,
Otto
Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
********************************************************************