Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to save and restore user grid column preferences
Message
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00641890
Message ID:
00641983
Views:
16
A thought... I would not use WriteExpression, rather I would do somethinh like the following:
local aProp(1), aPem(1), i, oCol
if not file('SavePems')
    create table SavePems (cuser c(20),Pems m)
else
   use SavePems in 0
endif
locate for cUser == this.cuser
if not found('SavePems')
    append blank
    replace cUser with this.cUser
endif


dimension aProp(1)m aPem(1)
for i = 1 to aMembers(aPem,this.oGrid)
    if pemstatus(this.oGrid,aPem(i),1)    && Get the changed properties only
        dimension aProp(alen(aProp,1)+1)
        aProp(alen(aProp,1)) = 'this.oGrid.'+aPem(i)+'='+trans(eval('this.oGrid.'+aPem(i)))
    endif
endfor
for each oCol in this.oGrid
  for i = 1 to aMembers(aPem,oCol)
    if pemstatus(oCol,aPem(i),1)
      dimension aProp(alen(aProp,1)+1)
      aProp(alen(aProp,1)) = ;
        'this.oGrid.'+oCol.name+'.'+aPem(i)+'='+trans(eval('this.oGrid.'+ocol.name+'.'+apem(i)))
    endif
   endfor
endfor

save to Memo all like aProp
use in SavePems
Not tested you need to fill in the blanks, and figure out the restore.

Glenn
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform