Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Current left column to right of locked columns
Message
From
30/11/2008 13:33:40
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
30/11/2008 09:23:55
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Vista
Network:
Windows XP
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01364611
Message ID:
01364724
Views:
13
>Cetin --
>
>Doesn't your example assume that the columns are still in their original order? I certainly would expect to see .ColumnOrder in there. I think that if your columns can move, you need to loop through all columns, essentially using .ColumnOrder instead of m.ix
>
>Jim

Jim,
AFAIK when columns locked VFP disables column moving. OTOH you are right I should do that from a safe coding point.
Public oForm
oForm = Createobject('SampleForm')
oForm.Show()

Procedure GetColumnOnLeft
  Lparameters toGrid
  Local ix
  With toGrid
    For ix = .LockColumns+1 To .ColumnCount
      If Objtoclient(.Columns(m.ix),2) > 0
        Return m.ix
      Endif
    Endfor
  Endwith
  Return -1
Endproc

Define Class sampleForm As Form
  DataSession = 2
  Height=400
  Width=600
  KeyPreview=.T.
  Add Object myGrid As Grid With ;
    Height=400,Width=600,Anchor=15,RecordSource='Customer'

  Procedure Load
    Set Multilocks On
    Use (_samples+'data\customer')
    * we don't want to save edits
    * simply setting buffering and will never update
    CursorSetProp("Buffering",5,'customer')
  Endproc
  Procedure Init
    This.myGrid.LockColumns=2
  Endproc
  Procedure KeyPress
    Lparameters nKey,nShift
    If m.nKey = -4 And ;
        TYPE('this.ActiveControl') = 'O' And ;
        !Isnull(This.ActiveControl) And ;
        this.ActiveControl=This.myGrid && F5 for this sample
      Nodefault
      Local lnIndex, oColumn
      lnIndex = GetColumnOnLeft( Thisform.myGrid )
      oColumn = Thisform.myGrid.Columns( m.lnIndex )
      Wait Window ;
        TEXTMERGE('<<oColumn.Header1.Caption>>'+;
        ' - [<<oColumn.ControlSource>>]:'+;
        '<<EVALUATE(oColumn.ControlSource)>>') Timeout 1
    Endif
  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