Problem with XBROWSE

Problem with XBROWSE

Postby demont frank » Tue Oct 07, 2008 1:54 pm

Hello

I try to use xbrowse with a one dimensional array :

Code: Select all  Expand view
@ 0,0 XBROWSE oBrw OF oChild;
  COLUMNS 1;
  SIZES nBr-40;
  SIZE nBr,nH-8;
  ARRAY arr;
  LINES;
  PIXEL
  oBrw:bkeyDown  := { | nkey | IIF(nkey==13 , (nAt := oBrw:nArrayAt , oChild:end()) , ) }
  oBrw:LDblClick := {||nAt := oBrw:nArrayAt , oChild:end()} //Is executed when the dialog is activated
  oBrw:CreateFromCode()



When oBrw:lDblClick is defined ,

::cDataType := valtype( EVAL( ::bEditValue ) )

It seems that EVAL(::bEditValue) executes oBrw:lDblclick

Placing a tracelog in lDblclick :

[\MCLS\HENWIN\ProcSixCdx.prg->(b)EENSELX] (1302) Called from:
xbrowse.prg->TXBRWCOLUMN:ADJUST(5533)
xbrowse.prg->TXBROWSE:ADJUST(724)
xbrowse.prg->TXBROWSE:INITIATE(708)
->__OBJSENDMSG(0)
...
I don't understand !
demont frank
 
Posts: 167
Joined: Thu Mar 22, 2007 11:24 am

Postby nageswaragunupudi » Wed Oct 08, 2008 11:47 pm

>
oBrw:LDblClick := {||nAt := oBrw:nArrayAt , oChild:end()} //Is executed when the dialog is activated
>

LDblClick is NOT data of TXBrowse for assiging a codeblock. LDblClick is a method. When program execution comes to the above line, actually LDblClick method is executed.

The above line could be written as :

Code: Select all  Expand view
   oBrw:aCols[ 1 ]:bLDClickData := { || nAt := oBrw:nArrayAt, oDlg:End() }


Here is a working example ( adopted from the code as in the original post )

Code: Select all  Expand view
#include 'fivewin.ch'
#include 'xbrowse.ch'

function Main()

   local oDlg, oBrw
   local aData := { 'AAAA', 99, 'CCCC', date() }
   local nAt   := 0

   DEFINE DIALOG oDlg SIZE 240,440 PIXEL

   @ 10,10 XBROWSE oBrw OF oDlg SIZE 100,200 PIXEL ;
      ARRAY aData AUTOCOLS LINES

   oBrw:bkeyDown  := { | nkey | IIF(nkey==13 , (nAt := oBrw:nArrayAt , oDlg:end()) , ) }
//  oBrw:LDblClick := {||nAt := oBrw:nArrayAt , oDlg:end()}
   oBrw:aCols[ 1 ]:bLDClickData := { || nAt := oBrw:nArrayAt, oDlg:End() }

   oBrw:CreateFromCode()

   ACTIVATE DIALOG oDlg CENTERED

   msginfo( nAt, 'RowSelected' )

return nil
Regards

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

Postby nageswaragunupudi » Wed Oct 08, 2008 11:53 pm

To make quick pick lists for selection, there is another simple way:

Code: Select all  Expand view
#include 'fivewin.ch'
#include 'xbrowse.ch'

function Main()

   local aData := { 'AAAA', 99, 'CCCC', date() }
   local uSelVal := 'none'

   XBROWSER aData SELECT uSelVal := oCol:Value

   MsgInfo( uSelVal )

return nil


With FWH 8.08 onwards you may compile and run this code
Regards

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


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 72 guests