Page 1 of 1

GOTFOCUS fires when column NOT in focus

Posted: Fri Feb 19, 2010 1:59 pm
by fursideup
the GOTFOCUS clause in DCBROWSECOL fires in a continuous loop when you double click in a different column

DCBROWSECOL FIELD ROP->part_no PARENT oBrowseRoParts HEADER 'Part No' WIDTH 10 ;
GOTFOCUS {||(wtf 'part number gotfocus clause'), IIF( PARTS->(dbseek(rop->part_no+rop->vendor)),;
(TL_TableView( 'PARTS', ROP->part_no, 'PARTS', .t., .t. ),.t.),;
(dc_msgbox('No such part number on file'),.t. )) } ;
EDITPROTECT {||tl_IsSerial()};
EDITOR 'GET_ROP_PART_NO' PICTURE '@!'

Re: GOTFOCUS fires when column NOT in focus

Posted: Fri Feb 19, 2010 2:03 pm
by rdonnay
I think that may be due to the WTF.

This generates a call to the debug browse window which causes another GOTFOCUS.

Re: GOTFOCUS fires when column NOT in focus

Posted: Mon Feb 22, 2010 2:49 pm
by fursideup
it fires without the WTF, I think it might be because it is the first col in the browse and it get focus by default whenever a refresh occours

Re: GOTFOCUS fires when column NOT in focus

Posted: Mon Feb 22, 2010 3:54 pm
by rdonnay
I'm having a difficult time reproducing this in a test program.

Can you modify the below test program in such a way that it will cause that problem?

Code: Select all

#include "dcdialog.ch"

function main()

local GetList[0], GetOptions, oBrowse, aDir

aDir := Directory()

@ 0,0 dcbrowse oBrowse data aDir Size 10,10 fit

dcbrowsecol element 1 header '1' width 10 parent oBrowse ;
  GOTFOCUS {|a|Something(oBrowse)}
dcbrowsecol element 2 header '2' width 10 parent oBrowse
dcbrowsecol element 3 header '3' width 10 parent oBrowse
dcbrowsecol element 4 header '4' width 10 parent oBrowse

dcread gui fit

return nil

proc appsys ; return

static function something( oBrowse )

dcmsgbox 'something'

return nil