Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Freezing few columns in grid in left position
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00479930
Message ID:
00480247
Vues:
17
Nadya/Peter/Vladmir,

Below is the class definition code. Hope it is useful to you. There were a few other cosmetic things that I removed which were directly tied to my own framework, so further testing is recommended before using it.

Scott
DEFINE CLASS grdlock AS grid

FontBold = .T.
FontSize = 8
DeleteMark = .F.
RowHeight = 17
ScrollBars = 0
*-- Number of columns to freeze (lock) on the grid
FreezeCols = 0
Name = "grdlock"

*-- Set to .T. when exiting the grid
GridExit = .F.


*-- Setup the panel properties
PROCEDURE PanelSetup
Local Idx,TotWid

THISFORM.LockScreen=.T.

If THIS.FreezeCols>0
  For Idx=1 to (THIS.FreezeCols)
    THIS.Partition=THIS.Partition+THIS.Columns(Idx).Width+1
    THIS.Columns(Idx).Enabled=.F.
    If THIS.Columns(Idx).BackColor=RGB(255,255,255)
      THIS.Columns(Idx).BackColor=THISFORM.BackColor
    Endif
  Endfor
  TotWid=10
  For Idx=1 to THIS.ColumnCount
    TotWid=TotWid+THIS.Columns(Idx).Width+1
  Endfor
  If TotWid < THIS.Width-SYSMETRIC(5)
    THIS.FreezeCols=0
    THIS.Partition=0
  Else
    THIS.PanelLink=.F.
    THIS.Panel=0
    THIS.RecordMark=.T.
    THIS.Partition=THIS.Partition+10
    THIS.ScrollBars=0
    THIS.Panel=1
    THIS.RecordMark=.F.
    THIS.PanelLink=.T.
  Endif
Endif

For Idx=1 to (THIS.FreezeCols)
  =THIS.DoScroll(5)
Endfor

THISFORM.LockScreen=.F.
ENDPROC


PROCEDURE Scrolled
LPARAMETERS nDirection
Local Idx

If (nDirection=4 OR nDirection=6) AND ;
  THIS.LeftColumn<=THIS.FreezeCols+1 AND ;
  THIS.Panel=1
  For Idx=THIS.LeftColumn to (THIS.FreezeCols)
    =THIS.DoScroll(5)
  Endfor
  THIS.Refresh()
Endif
ENDPROC


PROCEDURE AfterRowColChange
LPARAMETERS nColIndex
Local Idx

THISFORM.LockScreen=.T.
If THIS.Panel=0
  If THIS.LeftColumn#1
    For Idx=THIS.LeftColumn to 1 Step -1
      =THIS.DoScroll(4)
    Endfor
  Endif
  THIS.Panel=1
  Keyboard '{TAB}'
Else
  For Idx=THIS.LeftColumn to (THIS.FreezeCols)
    =THIS.DoScroll(5)
  Endfor
  If THIS.Columns(THIS.ActiveColumn).Enabled=.F.
    Keyboard '{TAB}'
  Endif
  THIS.Refresh()
Endif

THIS.ExitRowCol()
THISFORM.LockScreen=.F.
ENDPROC


PROCEDURE Init
  THIS.PanelSetup()
  THIS.SetAll("Resizable", .F., "Column")
  THIS.SetAll("Movable", .F., "Column")
  THIS.GridExit=.F.
  DoDefault()
ENDPROC


PROCEDURE BeforeRowColChange
LPARAMETERS nColIndex

If not THIS.GridExit
  THISFORM.LockScreen=.T.
Else
  THIS.GridExit=.F.
Endif
ENDPROC


PROCEDURE Valid
  THIS.GridExit=.T.
ENDPROC


*-- Allows for updating after the row or column changes.
PROCEDURE ExitRowCol
ENDPROC


ENDDEFINE
>Scott,
>
>Well, unfortunately it could be read only in Printed Issue (e.g. not available
>online) http://advisor.com/Articles.nsf/aid/LECLD02
>
>Perhaps, you can upload your class here, if it's ok with you? What do you
>think?
>
>Thanks in advance.
Scott King
The Support Source Corporation
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform