FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Forbid to set cursor on column
Posts: 1392
Joined: Mon May 14, 2007 09:49 AM
Forbid to set cursor on column
Posted: Fri Nov 18, 2016 02:39 PM

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 ?

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Forbid to set cursor on column
Posted: Sun Nov 20, 2016 12:03 PM
Please try this sample
Code (fw): Select all Collapse
#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
Posts: 1392
Joined: Mon May 14, 2007 09:49 AM
Re: Forbid to set cursor on column
Posted: Sun Nov 20, 2016 07:28 PM

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

Continue the discussion