Page 1 of 1

TXBrwColumn aEditListTxt

PostPosted: Mon Feb 21, 2022 4:04 pm
by Detlef
Hi all,
is there a way to find out the value of aEditListTxt[ nAt ] of a TXBrwColumn at the moment of selection?
I want to get the element of a parallel array.
But i'm stucked :(

Thanks for any hint
Detlef

Re: TXBrwColumn aEditListTxt

PostPosted: Mon Feb 21, 2022 5:24 pm
by MGA
Hello my friend, can this help you?

oBrw:aCols[2]:nEditType := EDIT_LISTBOX
oBrw:aCols[2]:aEditListBound := {'MARINGA','LONDRINA'}
oBrw:aCols[2]:aEditListTxt := { 51, 20}

//returns the selected code , ex: 20
msginfo(oBrw:aCols[2]:value)

Re: TXBrwColumn aEditListTxt

PostPosted: Mon Feb 21, 2022 6:16 pm
by Detlef
Dear MGA,
many thanks for your reply.
Unfortunately it doesn't solve my problem.

I have 2 arrays
a1 := [ "elem1", "elem2" ]
a2 := [ "white" , "blue" ]

a1 is my oBrw:aCols[2]:aEditListTxt.
If the 2nd element of a1 is clicked the column cell should become "elem2".

Now I need to know that the 2nd element was clicked.
To assign the 2nd element, value "blue" of a2 to an other column of the same row.

Therefore I think I need somthing like aEditListTxt[ nAt ].
But I don't now how to get the value of nAt.

Re: TXBrwColumn aEditListTxt

PostPosted: Tue Feb 22, 2022 9:12 pm
by nageswaragunupudi
Code: Select all  Expand view
oBrw:aCols[2]:bOnChange := ;
{ |o| o:oBrw:oCol( 3 ):VarPut( a2[ AScan( a1, o:Vaue ) ] ) }
 

assuming other column number is 3.

Re: TXBrwColumn aEditListTxt

PostPosted: Tue Feb 22, 2022 9:12 pm
by nageswaragunupudi
Code: Select all  Expand view
oBrw:aCols[2]:bOnChange := ;
{ |o| o:oBrw:oCol( 3 ):VarPut( a2[ AScan( a1, o:Vaue ) ] ) }
 

assuming other column number is 3.

Re: TXBrwColumn aEditListTxt

PostPosted: Tue Feb 22, 2022 9:16 pm
by Detlef
My issue is solved.
I build a codeblock which does an aScan on array a1 and so I get my nAt to find the corresponding element of array a2.

Many thanks to MGA who gave me the hint about "oBrw:aCols[2]:value".

Re: TXBrwColumn aEditListTxt

PostPosted: Tue Feb 22, 2022 9:25 pm
by Detlef
nageswaragunupudi wrote:
Code: Select all  Expand view
oBrw:aCols[2]:bOnChange := ;
{ |o| o:oBrw:oCol( 3 ):VarPut( a2[ AScan( a1, o:Vaue ) ] ) }
 

assuming other column number is 3.


This is much more smart.
Many thanks :D

Re: TXBrwColumn aEditListTxt

PostPosted: Wed Feb 23, 2022 8:34 pm
by Detlef
nageswaragunupudi wrote:
Code: Select all  Expand view
oBrw:aCols[2]:bOnChange := ;
{ |o| o:oBrw:oCol( 3 ):VarPut( a2[ AScan( a1, o:Vaue ) ] ) }
 

assuming other column number is 3.


This works very well.
But in case the 2nd column has been edited and I want to reselect the same item from 1st column:listbox to correct the 2nd column, it doesn' work.

I see the there is no 'change event' because i selected the same value from aEditListTxt as before.
So I tried bOnPostEdit. But this doesn't work too.

Is there a way to know that a txBrwColumn:aEditListTxt was selected even when it's not different as before?

Re: TXBrwColumn aEditListTxt

PostPosted: Wed Mar 02, 2022 7:51 am
by nageswaragunupudi
Is there a way to know that a txBrwColumn:aEditListTxt was selected even when it's not different as before?

No.
In the above case, logically, column 3 should not change if column 2 does not change.

1) Are you editing an array? Then there is a simpler way.

Re: TXBrwColumn aEditListTxt

PostPosted: Wed Mar 02, 2022 9:05 am
by Detlef
Thanks for jumping in Mr. Rao.
Columns 2 and 3 are not only listboxes but also editable.
If users make a false entry in col 3 it should be possible to repeat the mechanism to click again the same value in col 2 to correct the value in col 3.
And no, it's a dbf to edit.

Re: TXBrwColumn aEditListTxt

PostPosted: Wed Mar 02, 2022 10:01 am
by nageswaragunupudi
Detlef wrote:Thanks for jumping in Mr. Rao.
Columns 2 and 3 are not only listboxes but also editable.
If users make a false entry in col 3 it should be possible to repeat the mechanism to click again the same value in col 2 to correct the value in col 3.
And no, it's a dbf to edit.

You should not keep column 3 editable.
Set :nEditType := 0.

Re: TXBrwColumn aEditListTxt

PostPosted: Thu Mar 03, 2022 2:23 pm
by Detlef
Many thanks, Mr. Rao