Move the pointer at respective cell of column clicked

Move the pointer at respective cell of column clicked

Postby FranciscoA » Thu May 16, 2013 1:21 am

Hi,
How to put the pointer in the respective cell of the column clicked on his head?

I have a xbrowse with 20 columns, 8 visible, and two frozen.

If the pointer is in column 10 and I click on the header of the 12, how do I move the pointer to the respective cell in column 12?

I have this code, but it only works on the first 8 columns visible. If I move the cursor manually to the 15, and then I click on 13, the pointer goes haywire.
Code: Select all  Expand view

      :nMarqueeStyle  := MARQSTYLE_HIGHLCELL
For n := 1 to Len(oBrw:aCols)
      if oBrw:aCols[n]:nCreationOrder >= 3
         oBrw:aCols[n]:bLClickHeader := {|r,c,f,o| ;
                       oBrw:nColSel := o:nCreationOrder, oBrw:Refresh(),;  //mover el cursor a esa col
                       oBrw2:Refresh(.t.) }
      endif
   Next

Thanks.
Francisco J. Alegría P.
Chinandega, Nicaragua.

Fwxh-MySql-TMySql
User avatar
FranciscoA
 
Posts: 2158
Joined: Fri Jul 18, 2008 1:24 am
Location: Chinandega, Nicaragua, C.A.

Re: Move the pointer at respective cell of column clicked

Postby nageswaragunupudi » Thu May 16, 2013 3:31 am

Please try oBrw:SelectCol( <nCol> )
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10632
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Move the pointer at respective cell of column clicked

Postby FranciscoA » Thu May 16, 2013 3:04 pm

Mr. Nages, thanks for response.
Still the same.

Code: Select all  Expand view
    :nMarqueeStyle  := MARQSTYLE_HIGHLCELL
For n := 1 to Len(oBrw:aCols)
      if oBrw:aCols[n]:nCreationOrder >= 3
         oBrw:aCols[n]:bLClickHeader := {|r,c,f,o| ;
                      oBrw:SelectCol(o:nCreationOrder), oBrw:Refresh() } ,;    // oBrw:SelectCol(n)  // oBrw:nColSel := o:nCreationOrder,                        oBrw2:Refresh(.t.) }
      endif
   Next

Regards.
Francisco J. Alegría P.
Chinandega, Nicaragua.

Fwxh-MySql-TMySql
User avatar
FranciscoA
 
Posts: 2158
Joined: Fri Jul 18, 2008 1:24 am
Location: Chinandega, Nicaragua, C.A.

Re: Move the pointer at respective cell of column clicked

Postby FranciscoA » Thu May 16, 2013 5:07 pm

Hi,
I've solved so: (there is probably a better method, but this works)
The only drawback is that the columns changes position on display.
Code: Select all  Expand view
AEval( oBrw:aCols, { |o| o:bLClickHeader := {|r,c,f,o| SelectCell(o,oBrw) } } )
//-------------------------
Function SelectCell(o,oBrw)
local n, nPos:= o:nCreationOrder
oBrw:GoLeftMost()
For n:=2 to nPos
   oBrw:GoRight()
Next
oBrw:Refresh()
Return nil
 

Regards.
Francisco J. Alegría P.
Chinandega, Nicaragua.

Fwxh-MySql-TMySql
User avatar
FranciscoA
 
Posts: 2158
Joined: Fri Jul 18, 2008 1:24 am
Location: Chinandega, Nicaragua, C.A.


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 86 guests