New FiveForm.prg in FWH 12.07

New FiveForm.prg in FWH 12.07

Postby Antonio Linares » Sat Jul 28, 2012 1:59 pm

Image

Image

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
User avatar
Antonio Linares
Site Admin
 
Posts: 42203
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: New FiveForm.prg in FWH 12.07

Postby Antonio Linares » Sat Jul 28, 2012 2:41 pm

This is an example of an automatically generated source code from FiveForm.prg:

Code: Select all  Expand view  RUN
#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
User avatar
Antonio Linares
Site Admin
 
Posts: 42203
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: New FiveForm.prg in FWH 12.07

Postby Eoeo » Sat Jul 28, 2012 3: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
User avatar
Eoeo
 
Posts: 222
Joined: Mon Jun 04, 2012 12:00 pm

Re: New FiveForm.prg in FWH 12.07

Postby Otto » Tue Jul 31, 2012 8:03 am

You can use AUTOCODE to edit the generated code.
Best regards,
Otto


Image

Image
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6364
Joined: Fri Oct 07, 2005 7:07 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 62 guests