Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Filling a grid
Message
From
20/06/2006 06:45:27
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
20/06/2006 04:29:56
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Title:
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP
Network:
Windows 2000 Server
Miscellaneous
Thread ID:
01129787
Message ID:
01130197
Views:
17
Public form1
form1= Createobject('Form1')
form1.Visible = .T.
form1.Show
Define Class form1 As Form
  Top = 164
  Left = 78
  Height = 267
  Width = 823
  DoCreate = .T.
  Caption = "Filling"
  Name = "Form1"


  Add Object grid1 As Grid With ;
    Height = 181, ;
    Left = 36, ;
    ReadOnly = .T., ;
    Top = 72, ;
    Width = 732, ;
    Name = "Grid1"


  Add Object label1 As Label With ;
    AutoSize = .T., ;
    Caption = "From Line", ;
    Height = 17, ;
    Left = 60, ;
    Top = 11, ;
    Width = 58, ;
    Name = "Label1"


  Add Object combo1 As ComboBox With ;
    Height = 24, ;
    Left = 120, ;
    Top = 7, ;
    Width = 48, ;
    Name = "Combo1"


  Add Object label2 As Label With ;
    AutoSize = .T., ;
    Caption = "Column #", ;
    Height = 17, ;
    Left = 174, ;
    Top = 11, ;
    Width = 56, ;
    Name = "Label2"


  Add Object spinner1 As Spinner With ;
    Height = 25, ;
    KeyboardHighValue = 12, ;
    KeyboardLowValue = 1, ;
    Left = 240, ;
    SpinnerHighValue =  12.00, ;
    SpinnerLowValue =   1.00, ;
    Top = 7, ;
    Width = 36, ;
    Value = 1, ;
    Name = "Spinner1"


  Add Object label3 As Label With ;
    AutoSize = .T., ;
    Caption = "To Line", ;
    Height = 17, ;
    Left = 60, ;
    Top = 42, ;
    Width = 43, ;
    Name = "Label3"


  Add Object combo2 As ComboBox With ;
    Height = 24, ;
    Left = 120, ;
    Top = 38, ;
    Width = 48, ;
    Name = "Combo2"


  Add Object label4 As Label With ;
    AutoSize = .T., ;
    Caption = "Column #", ;
    Height = 17, ;
    Left = 174, ;
    Top = 42, ;
    Width = 56, ;
    Name = "Label4"


  Add Object spinner2 As Spinner With ;
    Height = 25, ;
    KeyboardHighValue = 12, ;
    KeyboardLowValue = 1, ;
    Left = 240, ;
    SpinnerHighValue =  12.00, ;
    SpinnerLowValue =   1.00, ;
    Top = 38, ;
    Width = 36, ;
    Value = 1, ;
    Name = "Spinner2"


  Add Object command1 As CommandButton With ;
    AutoSize = .T., ;
    Top = 37, ;
    Left = 285, ;
    Height = 27, ;
    Width = 35, ;
    FontBold = .T., ;
    Caption = "Fill", ;
    Name = "Command1"


  Procedure Activate
    Select crsrlines
  Endproc


  Procedure Load
    Create Cursor crsrlines (titlehead c(1),head1 c(1),;
      head2 c(1),head3 c(1),head4 c(1),head5 c(1),head6 c(1),head7 c(1),head8 c(1),;
      head9 c(1),head10 c(1),head11 c(1),head12 c(1))
    Insert Into crsrlines (titlehead) Values ('A')
    Insert Into crsrlines (titlehead) Values ('B')
    Insert Into crsrlines (titlehead) Values ('C')
    Insert Into crsrlines (titlehead) Values ('D')
    Insert Into crsrlines (titlehead) Values ('E')
    Insert Into crsrlines (titlehead) Values ('F')
    Insert Into crsrlines (titlehead) Values ('G')
    Insert Into crsrlines (titlehead) Values ('H')

    Go Top In crsrlines
  Endproc


  Procedure combo1.Init
    This.AddItem('A')
    This.AddItem('B')
    This.AddItem('C')
    This.AddItem('D')
    This.AddItem('E')
    This.AddItem('F')
    This.AddItem('G')
    This.Value='A'
  Endproc


  Procedure combo2.Init
    This.AddItem('A')
    This.AddItem('B')
    This.AddItem('C')
    This.AddItem('D')
    This.AddItem('E')
    This.AddItem('F')
    This.AddItem('G')
    This.Value='A'
  Endproc

  Procedure combo1.InteractiveChange
    Thisform.SetGridColor(1)
  Endproc
  Procedure combo2.InteractiveChange
    Thisform.SetGridColor(1)
  Endproc
  Procedure spinner1.InteractiveChange
    Thisform.SetGridColor(1)
  Endproc
  Procedure spinner2.InteractiveChange
    Thisform.SetGridColor(1)
  Endproc
  Procedure command1.Click
    Thisform.SetGridColor(2)
    Acopy(Thisform.aColorIndex,Thisform.aColorBuf)
  Endproc

  Procedure SetGridColor
    Lparameters tnColorIndex
    Acopy(This.aColorBuf,This.aColorIndex)
    Local lnRow,lnCol,lnCols
    lnCol  = Min(This.spinner1.Value,This.spinner2.Value)
    lnCols = Abs(This.spinner1.Value-This.spinner2.Value)+1
    For lnRow = Min(This.combo1.ListIndex,This.combo2.ListIndex) To ;
        MAX(This.combo1.ListIndex,This.combo2.ListIndex)
      This.aColorIndex[m.lnRow] = ;
        STUFF(This.aColorIndex[m.lnRow], ;
        m.lnCol, m.lnCols,Replicate(Padl(m.tnColorIndex,1),m.lnCols))
    Endfor
    This.grid1.Refresh
  Endproc

  Procedure Init
    Local ix
    This.AddProperty('aColorIndex['+Transform(Reccount('crsrlines'))+']',;
      REPLICATE('0',Fcount('crsrlines')))
    This.AddProperty('aColorBuf['+Transform(Reccount('crsrlines'))+']',;
      REPLICATE('0',Fcount('crsrlines')))
    With This.grid1
      For ix = 1 To .ColumnCount
        .Columns(m.ix).DynamicBackColor = ;
          "(thisform.GetGridColor(RECNO(),"+Transform(m.ix)+"))"
      Endfor
    Endwith
  Endproc

  Procedure GetGridColor
    Lparameters tnRow,tnCol
    Local lcIndex
    lcIndex = Substr(This.aColorIndex[m.tnRow],m.tnCol)
    Do Case
      Case lcIndex = '1'
        Return 0x00FFFF
      Case lcIndex = '2'
        Return 0xFF0000
      Endif
    Otherwise
      Return 0xFFFFFF
  Endcase
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform