Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Freezing few columns in grid in left position
Message
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00479930
Message ID:
00480253
Views:
20
Great! The question now is: how to create a visual class based on this code? :)
I know, how can I do it manually, but is here a utility for doing this automatically?

Thanks for sharing your class.

>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.
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform