Parameters m_formtitle,x_DOcase
Private m_formtitle,x_DOcase
Thisform.AddProperty("x_Do_Case",x_DOcase)
***thisform.x_Do_Case holds the procedure with the case statements for the selected button.
#Region 1
External Array m_gridcols
External Array m_cmdbtns
x_frmheight=_Screen.Height*.9
x_frmwidth=0
Thisform.Caption=m_formtitle
Thisform.Height=x_frmheight
Thisform.AutoCenter=.T.
*DEFINE WINDOW temp AT 1,1 TO 30,100 TITLE "Here we go again." && USED TO WATCH THE ACTION DURING TESTING
*MOVE WINDOW temp cent
*ACTIVATE WINDOW temp
** Grid
Thisform.grdList.ColumnCount=m_gridcolscnt
Thisform.grdList.Height=x_frmheight-33
**?ALIAS()
Thisform.grdList.RecordSource=Alias()
Thisform.grdList.ReadOnly=.T.
**ColumnX etc
For x=1 To m_gridcolscnt
m_columnname="Column"+Alltrim(Str(x,2))
** ?STR(x,2)+" "+m_columnname+" "+m_cntrlsrc
With Thisform.grdList.&m_columnname
.FontName="FOXFONT"
.FontSize=12
.Enabled=.F.
.ReadOnly=.T.
.ControlSource=m_gridcols(x,2)
.Width=m_gridcols(x,3)
Endwith
x_frmwidth=x_frmwidth+m_gridcols[x,3]
Endf
Thisform.Width=x_frmwidth+45
Thisform.grdList.Width=x_frmwidth+40
**ColumnX.Header1
For x=1 To m_gridcolscnt
m_columnheader="Column"+Alltrim(Str(x,2))+"."+"Header1"
**?m_columnheader
With Thisform.grdList.&m_columnheader
.FontName="FOXFONT"
.FontSize=12
.Caption=m_gridcols(x,1)
Endwith
Endf
**ColumnX,Text1
For x=1 To m_gridcolscnt
m_columntext="Column"+Alltrim(Str(x,2))+"."+"Text1"
*?m_columntext
With Thisform.grdList.&m_columntext
.Enabled=.F.
.ReadOnly=.T.
.Value="" &&m_value
.FontName="FOXFONT"
.FontSize=12
Endwith
Endf
*Command Group Buttons
x_cmdgrptop=Thisform.grdList.Height+2 &&x_frmheight-33 &&(WROWS()*FONTMETRIC(1))-50
x_btnleft=1
x_cmdgrpwidth=0
Thisform.cmdgrp.Top=x_cmdgrptop
Thisform.cmdgrp.ButtonCount=m_cmdbtnscnt
For x=1 To m_cmdbtnscnt
m_buttonname="Command"+Alltrim(Str(x,2))
m_width=m_cmdbtns[x,3]
m_caption=m_cmdbtns[x,2]
m_name="Cmd"+m_cmdbtns[x,1]
**?m_buttonname+" "+STR(m_width,10)+" "+m_caption+" "+m_name
With Thisform.cmdgrp.&m_buttonname
.Top=1
.Left=x_btnleft
.Height=27
.Width=m_width
.FontName="FOXFONT"
.FontSize=12
.Caption=m_caption
.BackColor=Rgb(255,255,255)
.Name=m_name
Endwith
x_btnleft=x_btnleft+m_cmdbtns[x,3]
x_cmdgrpwidth=x_cmdgrpwidth+m_width
Endf
Thisform.cmdgrp.Left=(Thisform.Width-x_cmdgrpwidth)/2
Thisform.cmdgrp.Width=x_cmdgrpwidth
**wait
**RELEASE WINDOWS temp
*thisform.grdList.Visible=.f.
Thisform.GotFocus
Thisform.Refresh