XBROWSE : PROBLEM WITH bDblClick

XBROWSE : PROBLEM WITH bDblClick

Postby demont frank » Wed Oct 08, 2008 9:50 am

Hello,

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
demont frank
 
Posts: 167
Joined: Thu Mar 22, 2007 11:24 am

Postby demont frank » Wed Oct 08, 2008 10:51 am

It seems a confusion between oBrw:bLDblClick and oBrw:LDblClick

Any how : oBrw:LDblClick is what ? inherits from ???

Frank
demont frank
 
Posts: 167
Joined: Thu Mar 22, 2007 11:24 am

Postby nageswaragunupudi » Thu Oct 09, 2008 12:03 am

demont frank wrote:It seems a confusion between oBrw:bLDblClick and oBrw:LDblClick

Any how : oBrw:LDblClick is what ? inherits from ???

Frank

oBrw:LDblClick is a METHOD not DATA for assigining the codeblock.

It should be oBrw:bLDblClick := bAction
or oBrw:aCols[ n ]:bLDClickData := bAction

One advantage of using command syntax is that we dont commit such small obscure mistakes and dont spend hours and days in debugging.
Regards

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

Postby demont frank » Thu Oct 09, 2008 6:34 am

nageswaragunupudi wrote:
demont frank wrote:It seems a confusion between oBrw:bLDblClick and oBrw:LDblClick

Any how : oBrw:LDblClick is what ? inherits from ???

Frank

oBrw:LDblClick is a METHOD not DATA for assigining the codeblock.

It should be oBrw:bLDblClick := bAction
or oBrw:aCols[ n ]:bLDClickData := bAction

One advantage of using command syntax is that we dont commit such small obscure mistakes and dont spend hours and days in debugging.


I agree , but why is oBrw:lDblClick accepted as a data ?
XBROWSE inherits from tControl and tcontrol from twindow , but lDblClick as data doesn't exist !

Another misterious problem is why EVAL(oCol:bEditvalue) executes lDblClick ?

Frank

Frank
demont frank
 
Posts: 167
Joined: Thu Mar 22, 2007 11:24 am


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 68 guests