Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Freeze a column in a grid
Message
De
01/07/2003 06:31:14
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
01/07/2003 02:50:14
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00805585
Message ID:
00805623
Vues:
29
>Hi,
>
>May I know how to freeze a column in a grid.
>
>
>Thanks and best regards.
>
>YT
oForm = Createobject('myForm')
oForm.Show
Read Events

Define Class myForm As Form
  Height = 400
  Width = 800
  DataSession = 2

  Add Object myGrid As myGrid With ;
    height = 400, Width = 800, ;
    recordsource = 'customer'

  Procedure Load
    Use customer
  Endproc
  Procedure QueryUnload
    Clear Events
  Endproc
EndDefine

Define Class myGrid As Grid
  LockCount = 2 && Columns to freeze on left
  Procedure Init
    With This
      lnVertScrollWidth = Iif(.ScrollBars < 2, 0, Sysmetric(5) )
      lnRecAndDelMarkWidth = ( Iif(.DeleteMark,0.6,0) + ;
        iif(.RecordMark,0.6,0) ) * lnVertScrollWidth
      lnGridLineWidth = Iif(.GridLines < 2, 0, .GridLineWidth )
      lnTotWidth = 0
      For ix = 1 To .LockCount
        lnTotWidth = lnTotWidth + .Columns(ix).Width + lnGridLineWidth
      Endfor
      .Partition = lnTotWidth + ;
        Iif(.GridLines < 2, 4, .GridLineWidth ) + ;
        lnVertScrollWidth + max(lnRecAndDelMarkWidth, 1)
      .ActivateCell(1,.LockCount+1) && Setfocus to 2nd panel
      Do While .LeftColumn<.LockCount+1
        .DoScroll(5)    && Scroll right
      Enddo
    Endwith

  Endproc

  Procedure BeforeRowColChange
    Lparameters nColIndex
    With This
      Do Case
        Case Inlist(Lastkey(),9,4,2) && Right
          If .Panel = 0 And This.Columns(nColIndex).ColumnOrder = .LockCount
            Nodefault
            .Columns(1).SetFocus()
            .Panel = 1
            .Columns(.LockCount+1).SetFocus()
          Endif
          If .Panel = 1 And  .Columns(nColIndex).ColumnOrder=.ColumnCount
            Nodefault
            .Columns(.LockCount+1).SetFocus()
            .Panel = 0
            .Columns(1).SetFocus()
          Endif
        Case Inlist(Lastkey(),15,19,26) && Left
          If .Panel = 0
            If .Columns(nColIndex).ColumnOrder=1
              Nodefault
              .Panel = 1
              .Columns(.ColumnCount).SetFocus()
            Endif
          Endif
          If .Panel = 1 And .Columns(nColIndex).ColumnOrder=.LockCount+1
            Nodefault
            .Panel = 0
            .Columns(.LockCount).SetFocus()
          Endif
        Otherwise
      Endcase
    Endwith
  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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform