FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Selected column in xbrowse
Posts: 1195
Joined: Mon Oct 17, 2005 05:41 AM
Selected column in xbrowse
Posted: Thu Mar 19, 2009 02:50 PM
Hi,

How can i know which column is selecten in xbrowse?

Now I'am using

Code (fw): Select all Collapse
vkolom := brw:nColSel


but this is not working if the browse is scrolling to the right. It returns the selected column that is currently displayed. Not the real column from the complete browse.

Thanks,
Marc
Regards,

Marc



FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
Re: Selected column in xbrowse
Posted: Thu Mar 19, 2009 03:22 PM
I made :
aSel:={}

.... add a column for the selection
oCol:= oApp():AddCol()
oCol:AddResource("C_Pal")
oCol:AddResource("STATO3")
oCol:bBmpData := { || Ds_Mar(1,2)}
oCol:cHeader := ""
oCol:nWidth := 25

oApp():bKeyDown :={|nKey| Val_nKey(nKey,oApp():oDlg)}
.....


STAT FUNC Val_nKey(nKey,oDlg)
CASE nKey==VK_F5
Selecciona()

.....



to Mark the record
STAT FUNC Ds_Mar(cBmp,cCan) // Marca
LOCAL cRet:=0
cRet:=IF((oDCli)->Status="B",cCan,cRet)
cRet:=IF(AScan(oT:aSel,(oDCli)->NumCli)<>0,cBmp,cRet)
RETURN (cRet)


STAT FUNC Selecciona() // Seleccionar registro
LOCAL x:=AScan(oT:aSel,(oDCli)->NumCli)
IF x<>0
ADel(oT:aSel,x)
ASize(oT:aSel,Len(oT:aSel)-1)
ELSE
AAdd(oT:aSel,(oDCli)->NumCli)
ENDIF
oApp():Refresh()
RETURN (NIL)



Best Regards, Saludos



Falconi Silvio
Posts: 1195
Joined: Mon Oct 17, 2005 05:41 AM
Re: Selected column in xbrowse
Posted: Thu Mar 19, 2009 05:42 PM
Thanks Silvio, but I just found an easyer solution in this forum

Code (fw): Select all Collapse
oBrw:ColAtPos( oBrw:nColSel ):nCreationOrder


Regards,
Marc
Regards,

Marc



FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Selected column in xbrowse
Posted: Sat Mar 21, 2009 05:59 PM

oBrw:SelectedCol() gives the column object of the column selected.

We can obtain the creation order by oBrw:SelectedCol():nCreationOrder, but there is no use knowing the creation order.

In xbrowse, the user can move the position of the columns at runtime, hide some columns and make some hidden columns visible. oBrw:aCols array at runtime is not in the creation order, but in the order of columns they appear on screen. Knowing the creation order does not help much.

What we are interested is to know what column object is selected and write some code to deal with that object.

oCol := oBrw:SelectedCol()
Write whatever code we want for this oCol. We are least concerned where this column appears on the screen.

Regards



G. N. Rao.

Hyderabad, India

Continue the discussion