>Public oform > >oform=Newobject("myform") >oform.Show > >Define Class myform As Form > DataSession = 2 > Top = 0 > Left = 0 > Height = 325 > Width = 564 > DoCreate = .T. > Caption = "Form1" > Name = "Form1" > > Add Object grdcustomer As Grid With ; > ColumnCount = 12, ; > Height = 273, ; > Left = 11, ; > RecordSource = "customer", ; > RecordSourceType = 1, ; > Top = 5, ; > Width = 541, ; > Name = "grdCustomer" > > Add Object combo1 As ComboBox With ; > Height = 24, ; > Left = 108, ; > Top = 288, ; > Width = 132, ; > Name = "Combo1" > > > Add Object label1 As Label With ; > Caption = "Change tag to", ; > Height = 17, ; > Left = 12, ; > Top = 292, ; > Width = 84, ; > Name = "Label1" > > > Procedure Init > With This.grdcustomer > .AddProperty('CurrentOrder',0) > Select Recno() As RcNo, 1 As OrderCol ; > from (.RecordSource) ; > order By OrderCol ; > into Cursor crsOrdering ; > readwrite > Select crsOrdering > Index On RcNo Tag RcNo > > Select (.RecordSource) > Local lcAlternatingExpression > lcAlternatingExpression = "Recno('crsOrdering')%2=0" > *!* Borrowed expression from Fabio Lunardon - alternate in 2 rows groups > *!* lcAlternatingExpression = "BitTest((Recno('crsOrdering')-1)/2,0)" > > .SetAll("DynamicBackColor", ; > "IIF(Seek(Recno(this.recordsource),'crsOrdering','rcno') and "+; > m.lcAlternatingExpression+",0xC0C0C0,0xFFFFFF)", "Column") > Endwith > Endproc > > Procedure grdcustomer.Refresh > Local lcOrder, lnOrder > With This > Select (.RecordSource) > lnOrder = Val(Sys(21)) > If .CurrentOrder # m.lnOrder > lcOrder = Iif(m.lnOrder = 0,'1',Key(m.lnOrder)) > Select Recno() As RcNo, &lcOrder As OrderCol ; > from (.RecordSource) ; > order By OrderCol ; > into Cursor crsOrdering ; > readwrite > Select crsOrdering > Index On RcNo Tag RcNo > Select (.RecordSource) > .CurrentOrder = m.lnOrder > Endif > Endwith > Endproc > > > Procedure combo1.InteractiveChange > Select customer > If ( This.Value == "None" ) > Set Order To 0 > Else > Set Order To Tag (This.Value) > Endif > Thisform.grdcustomer.Refresh() > Endproc > > > Procedure combo1.Init > Select customer > This.AddItem( "None" ) > For ix=1 To Tagcount() > This.AddItem( Tag(ix) ) > Endfor > Endproc > > Procedure Load > Use (_samples+'data\customer') > ENDPROC > >Enddefine >>