Konu: gridde solda 1 kolon sabit kalması
beceremedim:
LockColumns - LockcolumnsLeft - Partition - Panel kombinasyonlarını denedim
Giriş yapmadınız. Lütfen giriş yapın yada kayıt olun.
fox4um » Gridler ve Diğer Kontroller » gridde solda 1 kolon sabit kalması
beceremedim:
LockColumns - LockcolumnsLeft - Partition - Panel kombinasyonlarını denedim
http://www.tek-tips.com/viewthread.cfm? … p;page=731 siteye baksana
içeriğini alta kopyaladım
The approach is based on a simple principle. LeftColumn property of the grid represents a column that is currently the leftmost visible column in the grid with current horizontal scrolling. As we scroll the grid horizontally, this property changes. We can assign this number to the ColumnOrder property of the column we want to hold and that’s all:
this.Columns(1).ColumnOrder = this.LeftColumn
You can use this in the Scrolled and AfterRowColChange events of the grid. However, there is a little problem with this: order of columns spoiled after few scrolling forward and back. This is because column order changes using principle "replace older column by newer on that place", so older column is placed on place of newer column. Column orders of all other columns are not changed. This causes the problem. This FAQ describes an approach that allows to organize freezing of the column and workaround most issues.
The code is a very basic and simple to give the basics of the approach. Code samples could be improved to work correctly in case user change order of columns, as well as improve the logic related to the focus change.
Description
Following is a code that updates columns in grid to make first column always leftmost. Use it in the Scrolled event when grid is scrolled horizontally and in the AfterRowColChange event when active column is changed in the grid.
local i
if this.columns(1).ColumnOrder < this.LeftColumn
&& we scroll forward
for i=this.columns(1).ColumnOrder to this.LeftColumn-1
this.columns(1).ColumnOrder = this.columns(1).ColumnOrder + 1
endfor
else
&& we scroll backward
for i=this.LeftColumn+1 to this.columns(1).ColumnOrder
this.columns(1).ColumnOrder = this.columns(1).ColumnOrder - 1
endfor
endif
bir de buraya bak
http://www.tek-tips.com/faqs.cfm?fid=3477
kolay gelsin
Public oForm
oForm = Createobject('myForm')
oForm.Show
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
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
Çetin senin kodun gridi 2ye bölüyor, 2sinde de bütün sütunlar çıkıyor, birşeyler denedim ama başaramadım. Bir de galiba columncount=9 eksik .
http://www.tek-tips.com/faqs.cfm?fid=3477 istediğim gibi
yalnız nedense aftercolRowchangede lockscreen=.f. çalışmıyor - be de şimdilik locksuz yaptım.
teşekkürler
Ali Abi;
Galiba forum arşivinde istediğine benzer bir şey var:
http://www.fox4um.com/topic/1496/oledb-hatasi-hk/
fox4um » Gridler ve Diğer Kontroller » gridde solda 1 kolon sabit kalması