Forbid to set cursor on column

Post Reply
Natter
Posts: 1244
Joined: Mon May 14, 2007 9:49 am

Forbid to set cursor on column

Post by Natter »

Hi, all !

I leaf through xbrowse horizontal arrows right or left while one or the other column becomes current. Is it possible to forbid to set the cursor on the selected column ?
User avatar
nageswaragunupudi
Posts: 10733
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Been thanked: 11 times
Contact:

Re: Forbid to set cursor on column

Post by nageswaragunupudi »

Please try this sample

Code: Select all | Expand


#include "fivewin.ch"

function Main()

   local oBrw, oDlg
   local nCol  := 1
   local nSkipCol

   USE CUSTOMER NEW SHARED
   DEFINE DIALOG oDlg SIZE 900,400 PIXEL TRUEPIXEL

   @ 20,20 XBROWSE oBrw SIZE -20,-20 PIXEL OF oDlg ;
      DATASOURCE "CUSTOMER" AUTOCOLS CELL LINES NOBORDER


   nSkipCol    := 3 // should be less than the last column number

   WITH OBJECT oBrw
      :lColChangeNotify := .t.
      :bChange    := { |brw,lColChange| OnChange( brw, lColChange, @nCol, nSkipCol ) }
      //
      :CreateFromCode()
   END

   ACTIVATE DIALOG oDlg CENTERED

return nil

//----------------------------------------------------------------------------//

static function OnChange( oBrw, lColChange, nCol, nSkipCol )

   local oCol := oBrw:SelectedCol()

   if oCol:nCreationOrder == nSkipCol
      if oCol:nPos == 1 .or. oCol:nPos > nCol
         oBrw:GoRight()
      else
         oBrw:GoLeft()
      endif
   else
      nCol  := oBrw:nColSel
   endif

return nil

//----------------------------------------------------------------------------//
 

But normally there should not be such a requirement. If what is wanted is to skip some columns during fastedit, if oCol:bEditWhen evaluates to .T. or oCol:lReadOnly is .T. or oCo:nEditType is 0 (default) such columns are jumped over during fastedit.
Regards

G. N. Rao.
Hyderabad, India
Natter
Posts: 1244
Joined: Mon May 14, 2007 9:49 am

Re: Forbid to set cursor on column

Post by Natter »

Thank You, Mr. Rao, You are very help me !
Post Reply