Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Grids: Using PARTITION and SPLITBAR
Message
 
À
22/06/2005 12:53:00
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows 2000 SP4
Database:
Visual FoxPro
Divers
Thread ID:
01025509
Message ID:
01046882
Vues:
19
It would be really nice to be able hide the scroll bars in the left partition if PanelLink = .T.

Regards
Geoff Scott

>>I'm using VFP9 and i'm hoping to lock the first 4 columns in a 20+ column grid so that when the user scrolls to the right, the first 4 columns remain visible (similar to excel).
>>
>>I thought this is what PARTITION and SPLITBAR properties are for. But cant get it to work. I had set SPLITBAR to true on the grid and set PARTITION to 4. After saving the form i cant run it or even MODIFY the form. I had to hack the scx and remove those 2 settings from the PROPERTIES field for the grid row in the SCX in order to be able to modify the form again.
>>
>>Can these 2 properties be used to lock columns?
>
>Splitbar only tells if there would be a split and partition tells the grid partition's width.
>IMHO though not perfect below code works better then LockColumn* of VFP9 (and works with older versions):
>
>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
May all your weeds be wildflowers
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform