Page 1 of 1

Editing and Updating a Value in DCBROWSECOL

Posted: Tue Apr 05, 2011 9:55 am
by GeneB
I am trying to edit a value in DCBROWSECOL with a function, MyFunction, called by VALID.
When MyFunction closes, I need to pass the value back to DCBROWSECOL and have the screen display the new value in the cell.

I have tried, among other things, the code below.
The result is that the value in the cell for Element 2 is originally typed "ABC 1234", MyFunction allows the user to select "ABC 1234 GOLD", the second value flashes in the cell after closing MyFunction and is quickly replaced with the original value "ABC 1234". The number of choices is over 200,000 so is too big for a user to select from without narrowing the choices. MyFunction narrows them based on what is originally typed in the cell, so if I use DCCOMBOBOX the array of choices would have to built and passed to DCCOMBOBOX after the data is typed into the cell.

Could someone kindly show me how to do this?
Thanks in advance.
GeneB

Code: Select all

   @ 1,1 DCBROWSE oThings  DATA aThings  SIZE 50,8 ;
      EDIT xbeBRW_ItemSelected MODE DCGUI_BROWSE_EDITACROSSDOWN

      DCBROWSECOL ELEMENT 1  HEADER "Qty"   PARENT oThings WIDTH 3  EDITOR 'QtyEditor'
         @ nil,nil DCGET xNil PICT "999" ;
         GETID 'QtyEditor'

      DCBROWSECOL ELEMENT 2  HEADER "Item"  PARENT oThings WIDTH 20   EDITOR 'ItemEditor'
         @ nil,nil DCGET xNil PICT "@!" ;
         GETID 'ItemEditor' ;
         VALID {|| xNil := MyFunction(xNil) ;
                 , DC_GetRefresh(getlist) ;
                 , .T. }

Re: Editing and Updating a Value in DCBROWSECOL

Posted: Wed Apr 06, 2011 8:36 pm
by GeneB
DATALINK or VarGet() ?
Use a CRT screen?

Re: Editing and Updating a Value in DCBROWSECOL

Posted: Thu Apr 07, 2011 1:24 am
by skiman
Hi,

This is how I'm doing it.

Code: Select all

@ nil , nil DCGET xNil GETID 'EDITREK' FONT '9.arial' PICTURE '@K9999999' ;
       VALID {|oGet,cVar,o| cVar:=oGet:Get:varget(),;
               cVar := myfunction(cVar) ,;
               oGet:get:varput(cVar),oGet:get:updatebuffer(),;
               oBrowse:Refreshall(),setappfocus(oBrowse),.T.} 

Re: Editing and Updating a Value in DCBROWSECOL

Posted: Thu Apr 07, 2011 5:59 am
by rdonnay
Can you give me a sample that I can compile and run?

Re: Editing and Updating a Value in DCBROWSECOL

Posted: Thu Apr 07, 2011 7:11 am
by GeneB
Thanks, Chris, this works perfectly. I learned something.
Thank you for your time.
-=# GeneB