Another error when i Input TAB on the open listbox:
Error BASE/1005 Class: 'NIL' has no property: NLASTKEY
Args:
[ 1] = U
[ 2] = N 13
Error BASE/1005 Class: 'NIL' has no property: NLASTKEY
Args:
[ 1] = U
[ 2] = N 13
@ 0, 0 LISTBOX ::oEditLbx VAR nAt OF ::oBrw SIZE 0,0 ITEMS ::aEditListTxt ;
COLOR aColors[ 1 ], aColors[ 2 ] FONT oFont
::oEditLbx:bLostFocus := { | oLbx, hWndFocus | ::PostEdit( aBound[ Max( 1, nAt ) ] ) }
::oEditLbx:bLButtonUp := {|| ::oEditLbx:Change(),;
If( ::oEditLbx != nil, ::oEditLbx:nLastKey := VK_RETURN,),;
::PostEdit( aBound[ nAt ], .t. ) }
::oEditLbx:bChange = {|| If( ::oEditLbx != nil, ::oEditLbx:nLastKey := VK_RETURN,) }
IF ::oBrw:oWnd:IsKindOf( "TDIALOG" )
::oEditLbx:nDlgCode = DLGC_WANTALLKEYS
::oEditLbx:bKeyDown := {|k| If( ::oEditLbx != nil, ::oEditLbx:nLastKey := k,), nil }
... case ::nEditType == EDIT_LISTBOX
if xValue != nil
if ::bEditWhen == nil .or. Eval( ::bEditWhen, Self ) .and. ::oEditLbx:nLastKey == VK_RETURN
Eval( ::bOnPostEdit, Self, xValue, If( ::oEditLbx != nil, ::oEditLbx:nLastKey, 0 ) )
endif#include "FiveWin.ch"
function Main()
local oDlg, oBrw, aValues := { Array( 2 ) }
DEFINE DIALOG oDlg SIZE 500, 300
@ 0, 0 XBROWSE oBrw OF oDlg ;
FIELDS aValues[ oBrw:nArrayAt ][ 1 ], aValues[ oBrw:nArrayAt ][ 2 ] ;
COLSIZES 220, 220 ;
HEADERS "One", "Two"
oBrw:SetArray( aValues )
oBrw:aCols[ 1 ]:nEditType = EDIT_GET_LISTBOX
oBrw:aCols[ 1 ]:aEditListTxt = { "111111", "22222" }
oBrw:aCols[ 1 ]:bOnPostEdit = { | o, v | MsgInfo( v ) }
oBrw:CreateFromCode()
oDlg:oClient = oBrw
ACTIVATE DIALOG oDlg CENTERED ;
ON INIT oDlg:ReSize()
return nil @ 0, 0 LISTBOX ::oEditLbx VAR nAt OF ::oBrw SIZE 0,0 ITEMS ::aEditListTxt ;
COLOR aColors[ 1 ], aColors[ 2 ] FONT oFont
::oEditLbx:bLostFocus := { | oLbx, hWndFocus | ::PostEdit( aBound[ Max( 1, nAt ) ] ) }
::oEditLbx:bLButtonUp := {|| ::oEditLbx:Change(),;
::PostEdit( aBound[ nAt ], .t. ) }
::oEditLbx:bChange = {|| If( ::oEditLbx != nil, ::oEditLbx:nLastKey := VK_RETURN,) }
IF ::oBrw:oWnd:IsKindOf( "TDIALOG" )
::oEditLbx:nDlgCode = DLGC_WANTALLKEYS
::oEditLbx:bKeyDown := { | nKey | If( nKey == VK_RETURN,;
( ::oEditLbx:Change(),;
::PostEdit( aBound[ nAt ], .t. ) ),) }
ELSEError BASE/1005 Class: 'NIL' has no exported method: CHANGE
Args:
[ 1] = U
Antonio, please look also on this last two Points!
Many thanks!
Günther,
Please go to line 11135 in xbrowse.prg and change this:
::oEditLbx:Move( nRow, nCol, nWidth, nHeight, .t. )
to
nRow = If( nRow + nHeight > ::nHeight, ::nHeight - nHeight, nRow )
::oEditLbx:Move( nRow, nCol, nWidth, nHeight, .t. )
::oEditLbx:bKeyDown := { | nKey | If( nKey == VK_RETURN,;
( If( ::oEditLbx != nil, ::oEditLbx:Change(),),;
::PostEdit( aBound[ nAt ], .t. ) ),) }Please go to line 11135 in xbrowse.prg and change this:
::Move( nRow, nCol, nWidth, nHeight, .t. )
to
nRow = If( nRow + nHeight > ::nHeight, ::nHeight - nHeight, nRow )
::Move( nRow, nCol, nWidth, nHeight, .t. )
Günther,
Look for ::oEditLbx:Move in xbrowse.prg, there is only one occurrence and change it there as explained.
I have not tested it myself, but I think it should work ![]()
If nRow + nHeight > ::oBrw:BrwHeight()
If (::oBrw:BrwHeight() - nRow) < ::oBrw:nRowHeight
do while ( nRow - nHeight - ::oBrw:nRowHeight + 1 ) < 0
nHeight -= FontHeight( ::oBrw, ::oBrw:oFont )
enddo
nRow := nRow - nHeight - ::oBrw:nRowHeight + 1
else
nHeight := ::oBrw:BrwHeight() - nRow
Endif
Endif#include "FiveWin.ch"
function Main()
local oDlg, oBrw, aValues := { Array( 2 ) }, n
for n = 1 to 50
AAdd( aValues, ATail( aValues ) )
next
DEFINE DIALOG oDlg SIZE 500, 300
@ 0, 0 XBROWSE oBrw OF oDlg ;
FIELDS aValues[ oBrw:nArrayAt ][ 1 ], aValues[ oBrw:nArrayAt ][ 2 ] ;
COLSIZES 220, 220 ;
HEADERS "One", "Two"
oBrw:SetArray( aValues )
oBrw:aCols[ 1 ]:nEditType = EDIT_GET_LISTBOX
oBrw:aCols[ 1 ]:aEditListTxt = { "111111", "22222" }
oBrw:aCols[ 1 ]:bOnPostEdit = { | o, v | MsgInfo( v ) }
oBrw:CreateFromCode()
oDlg:oClient = oBrw
ACTIVATE DIALOG oDlg CENTERED ;
ON INIT oDlg:ReSize()
return nil
Antonio it works! If also the vscroll are functioning, this is a perfect thing. Is it possibility, the listbox drawing over the size from the browse as it is also on normal dialogs?
Günther,
Do you mean that the listbox is out of the browse area ?
Rao has implemented a better version that takes some more details into account for a better positioning of the listbox