Yesterday i reported some problems , now i have an example :
- Code: Select all Expand view
# include "FiveWin.ch"
# include "xBrowse.ch"
function Main()
local oBmp , oWnd
DEFINE WINDOW oWnd TITLE "TEST TXBROWSE : LDBLCLICK" ;
MENU BuildMenu( oWnd ) MDI
ACTIVATE WINDOW oWnd
CLOSE ALL
return nil
//----------------------------------------------------------------------------//
function BuildMenu( oWnd )
local oMenu
local cFile
MENU oMenu
MENUITEM "LDBLCLICK IN XBROWSE COMMAND";
ACTION msginfo(module1(oWnd ,1))
MENUITEM "bLdblClick seperately";
ACTION msginfo(module1(oWnd ,2))
oMenu:AddMdi()
ENDMENU
return oMenu
//----------------------------------------------------------------------------//
STATIC FUNC module1(oWndMdi,n)
LOCAL oWndChild , oDlg
LOCAL oBrw , Arr := {"one","two"}
LOCAL nAt
DEFINE DIALOG oDlg TITLE "ONE DIMENSIONAL ARRAY : FROM CODE " OF oWndMdi
IF n == 2
@ 0,0 XBROWSE oBrw OF oDlg;
ARRAY arr;
LINES
oBrw:LDblClick := {||nAt := oBrw:nArrayAt , oDlg:end() }
ELSE
@ 0,0 XBROWSE oBrw OF oDlg;
ARRAY arr;
LINES;
ON DBLCLICK (nAt := oBrw:nArrayAt , oDlg:end())
END
oBrw:bkeyDown := { | nkey | IIF(nkey==13 , (nAt := oBrw:nArrayAt , oDlg:end()) , ) }
oBrw:CreateFromCode()
ACTIVATE DIALOG oDlg
RETU nAt
The goal is to select in a array , using keyboard (ENTER) or LEFT DOUBLE CLICK
When DBLCLICK is used in the COMMAND to preproces , no problem
But when bLdblClick is defined in the program , this block is executed during initialisation . Placing a tracelog in the block has as result :
[TestGetbaction.prg->(b)MODULE1] (41) Called from:
xbrowse.prg->TXBRWCOLUMN:ADJUST(5487) // ::cDataType := valtype( EVAL( ::bEditValue ) )
xbrowse.prg->TXBROWSE:ADJUST(712)
xbrowse.prg->TXBROWSE:INITIATE(696)
->__OBJSENDMSG(0)
.\source\function\HARBOUR.PRG->OSEND(0)
.\source\function\HARBOUR.PRG->ASEND(0)
.\source\classes\DIALOG.PRG->TDIALOG:INITIATE(0)
.\source\classes\DIALOG.PRG->TDIALOG:HANDLEEVENT(0)
->DIALOGBOXINDIRECT(0)
.\source\classes\DIALOG.PRG->TDIALOG:ACTIVATE(0)
TestGetbaction.prg->MODULE1(50)
TestGetbaction.prg->(b)BUILDMENU(23)
.\source\classes\MENU.PRG->TMENU:COMMAND(0)
.\source\classes\WINDOW.PRG->TWINDOW:COMMAND(0)
.\source\classes\MDIFRAME.PRG->TMDIFRAME:COMMAND(0)
->TMDIFRAME:HANDLEEVENT(0)
.\source\classes\WINDOW.PRG->_FWH(0)
->WINRUN(0)
.\source\classes\WINDOW.PRG->TMDIFRAME:ACTIVATE(0)
TestGetbaction.prg->MAIN(10)
[TestGetbaction.prg->(b)MODULE1] (41) Called from:
xbrowse.prg->(b)TXBRWCOLUMN:ADJUST(5504)
xbrowse.prg->TXBRWCOLUMN:DATAWIDTH(5788)
xbrowse.prg->TXBRWCOLUMN:ADJUST(5526)
xbrowse.prg->TXBROWSE:ADJUST(712)
xbrowse.prg->TXBROWSE:INITIATE(696)
->__OBJSENDMSG(0)
.\source\function\HARBOUR.PRG->OSEND(0)
.\source\function\HARBOUR.PRG->ASEND(0)
.\source\classes\DIALOG.PRG->TDIALOG:INITIATE(0)
.\source\classes\DIALOG.PRG->TDIALOG:HANDLEEVENT(0)
->DIALOGBOXINDIRECT(0)
.\source\classes\DIALOG.PRG->TDIALOG:ACTIVATE(0)
TestGetbaction.prg->MODULE1(50)
TestGetbaction.prg->(b)BUILDMENU(23)
.\source\classes\MENU.PRG->TMENU:COMMAND(0)
.\source\classes\WINDOW.PRG->TWINDOW:COMMAND(0)
.\source\classes\MDIFRAME.PRG->TMDIFRAME:COMMAND(0)
->TMDIFRAME:HANDLEEVENT(0)
.\source\classes\WINDOW.PRG->_FWH(0)
->WINRUN(0)
.\source\classes\WINDOW.PRG->TMDIFRAME:ACTIVATE(0)
TestGetbaction.prg->MAIN(10)
So : 1) Why EVAL(::bEditValue ) executes bDblClick
2) Why it is exected twice ?
In many cases i don't use the Pre processed XBROWSE command. Can bDblClicl be used savely ?
Frank