FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour New FiveForm.prg in FWH 12.07
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
New FiveForm.prg in FWH 12.07
Posted: Sat Jul 28, 2012 01:59 PM




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".
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: New FiveForm.prg in FWH 12.07
Posted: Sat Jul 28, 2012 02:41 PM
This is an example of an automatically generated source code from FiveForm.prg:

Code (fw): Select all Collapse
#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

//----------------------------------------------------------------------------//
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 222
Joined: Mon Jun 04, 2012 12:00 PM
Re: New FiveForm.prg in FWH 12.07
Posted: Sat Jul 28, 2012 03:56 PM

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

Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Re: New FiveForm.prg in FWH 12.07
Posted: Tue Jul 31, 2012 08:03 AM
You can use AUTOCODE to edit the generated code.
Best regards,
Otto




Continue the discussion