xBrowse + TDolphin EDIT_GET_LISTBOX

xBrowse + TDolphin EDIT_GET_LISTBOX

Postby Rimantas » Sat Mar 09, 2013 8:28 am

Hi ,

Want to do column editing with listbox . Values in array ~ 800 ...
So I tried that :
WITH OBJECT oCol
:bEditValue := { || oQry:preke }
:nEditType := if( lEdt, EDIT_GET_LISTBOX, EDIT_NONE )
:aEditListTxt := aMod
END

Sorry , but trying to open listbox , app hangs ... How can this be solved ?

Fwh 11.11 , Harbour 3.1 MinGW
Rimantas U.
User avatar
Rimantas
 
Posts: 437
Joined: Fri Oct 07, 2005 12:56 pm
Location: Utena , Lithuania

Re: xBrowse + TDolphin EDIT_GET_LISTBOX

Postby nageswaragunupudi » Sat Mar 09, 2013 1:11 pm

You may use EDIT_LISTBOX for smaller arrays.
For the kind of arrays having 800 elements etc you may better use an external function to select with EDIT_BUTTON functionality.
Regards

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

Re: xBrowse + TDolphin EDIT_GET_LISTBOX

Postby Rimantas » Sat Mar 09, 2013 2:18 pm

nageswaragunupudi wrote:You may use EDIT_LISTBOX for smaller arrays.
For the kind of arrays having 800 elements etc you may better use an external function to select with EDIT_BUTTON functionality.


OK , understand ... Thanks !
Rimantas U.
User avatar
Rimantas
 
Posts: 437
Joined: Fri Oct 07, 2005 12:56 pm
Location: Utena , Lithuania

Re: xBrowse + TDolphin EDIT_GET_LISTBOX

Postby Rimantas » Sat Mar 09, 2013 5:01 pm

Rimantas wrote:
nageswaragunupudi wrote:You may use EDIT_LISTBOX for smaller arrays.
For the kind of arrays having 800 elements etc you may better use an external function to select with EDIT_BUTTON functionality.


OK , understand ... Thanks !


Changed EDIT_LISTBOX with EDIT_BUTTON ...
Code: Select all  Expand view

WITH OBJECT oCol
   :bEditValue      := { || oQry:preke }
   :nEditType       := if( lEdt, EDIT_BUTTON, EDIT_NONE )
   :bEditBlock      := { | nRow, nCol, oCol | oCol:Value := brw_arr( "Choose!", { "Item", "Item name" }, aMod, oWnd ) } // mine function of array , which will return value
   :bOnPostEdit     := { | oCol, xVal, nKey | if( nKey == VK_RETURN .and. ascan( aMod, { |x| x[ 1 ] == xVal } ) <> 0, ( oQry:FieldPut( oCol:cExpr, xVal ), oQry:Save() ), ) } // 104 line
END
 


Now building app. I'm getting error : uzs.prg(104) Error E0005 Outer codeblock variable 'XVAL' is out of reach . The same xVal in other bOnPostEdit works without problem . :bOnPostEdit := { | oCol, xVal, nKey | if( nKey == VK_RETURN, ( oQry:FieldPut( oCol:cExpr, xVal ), oQry:Save() ), ) }

To what that related ?
Rimantas U.
User avatar
Rimantas
 
Posts: 437
Joined: Fri Oct 07, 2005 12:56 pm
Location: Utena , Lithuania

Re: xBrowse + TDolphin EDIT_GET_LISTBOX

Postby nageswaragunupudi » Sat Mar 09, 2013 5:33 pm

Error E0005 Outer codeblock variable 'XVAL' is out of reach

Yes.
We can not use the parameter of the main codeblock inside another codeblock used within the main codeblock.

We need to create a function for that.
Regards

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

Re: xBrowse + TDolphin EDIT_GET_LISTBOX

Postby Rimantas » Sat Mar 09, 2013 8:21 pm

nageswaragunupudi wrote:
Error E0005 Outer codeblock variable 'XVAL' is out of reach

Yes.
We can not use the parameter of the main codeblock inside another codeblock used within the main codeblock.

We need to create a function for that.



Thanks , Rao ! Understand ...
Rimantas U.
User avatar
Rimantas
 
Posts: 437
Joined: Fri Oct 07, 2005 12:56 pm
Location: Utena , Lithuania

Re: xBrowse + TDolphin EDIT_GET_LISTBOX

Postby Rimantas » Sun Mar 10, 2013 8:39 am

Rimantas wrote:
nageswaragunupudi wrote:
Error E0005 Outer codeblock variable 'XVAL' is out of reach

Yes.
We can not use the parameter of the main codeblock inside another codeblock used within the main codeblock.

We need to create a function for that.


Thanks , Rao ! Understand ...


Hello Rao ! Can you help also ? I redid this place with EDIT_GET_BUTTON :

Code: Select all  Expand view

WITH OBJECT oCol
   :bEditValue      := { || oQry:preke }
   :nEditType       := if( lEdt, EDIT_GET_BUTTON, EDIT_NONE )
   :bEditBlock      := { | nRow, nCol, oCol | uVal := brw_arr( "Choose!", { "Model", "Description" }, aMod, oCol:Value ), ;
   if( !empty( uVal ) .and. uVal <> oCol:Value, oQry:FieldPut( oCol:cExpr, uVal ), ) }
   :bOnPostEdit     := { | oCol, xVal, nKey | if( mod_pas( aMod, xVal ), ( oQry:FieldPut( oCol:cExpr, xVal ), oQry:Save() ), ) }
END
 


Edit block get new value , which return from mine function brw_arr() . But it not run bOnPostEdit . I must to press Enter if want to save . How to run bOnPostEdit after when bEditBlock get new value ?
Rimantas U.
User avatar
Rimantas
 
Posts: 437
Joined: Fri Oct 07, 2005 12:56 pm
Location: Utena , Lithuania

Re: xBrowse + TDolphin EDIT_GET_LISTBOX

Postby nageswaragunupudi » Sun Mar 10, 2013 12:20 pm

Code: Select all  Expand view
WITH OBJECT oCol
   :bEditValue      := { || oQry:preke }
   :bEditWhen       := { || lEdt }
   :nEditType       := EDIT_GET_BUTTON
   :bEditBlock      := { | nRow, nCol, oCol | brw_arr( "Choose!", { "Model", "Description" }, aMod, oCol:Value )
   :bOnPostEdit     := { | oCol, xVal, nKey | If( nKey == VK_ESCAPE,,( oQry:preke := xVal, oQry:Save() ) ) }
END
 


The function brw_arr(...) should return
- the selected Model code if the user selects a model
- or should return NIL if the user aborts the selection.

If bEditBlock returns NIL, xbrowse does not take any action.
If bEditBlock returns a Non Nil value, xbrowse evaluates bOnPostEdit with the retuned value.
Regards

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

Re: xBrowse + TDolphin EDIT_GET_LISTBOX

Postby Rimantas » Sun Mar 10, 2013 12:41 pm

nageswaragunupudi wrote:
Code: Select all  Expand view
WITH OBJECT oCol
   :bEditValue      := { || oQry:preke }
   :bEditWhen       := { || lEdt }
   :nEditType       := EDIT_GET_BUTTON
   :bEditBlock      := { | nRow, nCol, oCol | brw_arr( "Choose!", { "Model", "Description" }, aMod, oCol:Value )
   :bOnPostEdit     := { | oCol, xVal, nKey | If( nKey == VK_ESCAPE,,( oQry:preke := xVal, oQry:Save() ) ) }
END
 


The function brw_arr(...) should return
- the selected Model code if the user selects a model
- or should return NIL if the user aborts the selection.

If bEditBlock returns NIL, xbrowse does not take any action.
If bEditBlock returns a Non Nil value, xbrowse evaluates bOnPostEdit with the retuned value.


Works very fine now ! Many thanks to you, Rao ! :)
Rimantas U.
User avatar
Rimantas
 
Posts: 437
Joined: Fri Oct 07, 2005 12:56 pm
Location: Utena , Lithuania


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 42 guests