Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Iif(mod(recno()/2)=0,rgb(),rgb()) doesn't work
Message
De
20/11/2007 13:02:09
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
20/11/2007 06:02:32
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01270108
Message ID:
01270216
Vues:
29
>iif(mod(recno()/2)=0,rgb(),rgb()) this command is used to change the dynamicbackcolor of grid. but it doesn't work well on indexed vues or tables. how to correct it ?
Public oform1

oform1=Newobject("form1")
oform1.Show
Return

Define Class form1 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(m.ix) )
    Endfor
  Endproc

  Procedure Load
    Use (_samples+'data\customer')
  Endproc

Enddefine
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform