Page 1 of 1

DCBROWSECOL EDITOR

Posted: Mon Aug 12, 2013 12:31 am
by Koverhage
Hi,

i have a problem. In a DCBROWSECOL i want search and use the selected vavlue.
But i can't see the selected value (except i press the del key).
What i make wrong ?

Code: Select all

DCBROWSECOL FIELD nkp->nka_ts  PICTURE '999' WIDTH 3 HEADER "Nr." ;
            EDITOR 'NKATS' PARENT oBrowse

@ nil,nil DCGET xNIL PICT '999' GETID 'NKATS' PARENT oBrowse ;
          KEYBLOCK {|n|IIF(n==xbeK_F2,;
          nkotxt_ausw( dc_getactiveinfo( GetList ), GetList, .f., oBrowse ),nil)}

static procedure nkotxt_ausw( akt_feld, aGetList, lMitLock, oCBrowse )
Local ret_rec := 0, lOk, GetList := {}, cAlias := "kt", oBrowse, GetOptions := {}

Local mess96 := 'TS', ;
      mess97 := 'Kostenbezeichnung', ;
      mess98 := 'Mwst-Satz', ;
      mess99 := 'Auskunft Kostentexte'


DEFAULT lMitLock := .f.

@  0,  0 DCBROWSE oBrowse ALIAS cAlias SIZE 69, 20 ;
         SORTSCOLOR GRA_CLR_WHITE, GRA_CLR_RED ;
         SORTUCOLOR GRA_CLR_WHITE, GRA_CLR_DARKGRAY ;
         ITEMSELECTED {||DC_ReadGuiEvent(DCGUI_EXIT_OK,GetList) }
DCSETPARENT oBrowse
DCBROWSECOL DATA {|| kt->tnr } HEADER mess96 PROTECT {|| .t. };
            WIDTH 4  picture "999" ;
            SORT {||OrdSetFocus(1), DC_GetRefresh( GetList )} _DEFAULT OrdSetFocus()=='KSTXT'
DCBROWSECOL DATA {|| kt->tbez } HEADER mess97 PROTECT {|| .t. };
            WIDTH 32  picture "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" ;
            SORT {||OrdSetFocus(2), DC_GetRefresh( GetList )} _DEFAULT OrdSetFocus()=='KSBEZ'
DCBROWSECOL field kt->mwstp HEADER mess98 WIDTH 5  picture "@E 99.99"  PROTECT {|| .t. }

DCGETOPTIONS BUTTONALIGN DCGUI_BUTTONALIGN_CENTER ;
             COLORGETS {{GRA_CLR_BLACK,GRA_CLR_YELLOW}} 
             
DCHOTKEY xbeK_F1 ACTION  {|| my_help( dc_getactiveinfo( GetList ) ) }
DCHOTKEY xbeK_F12 ACTION  {|| DC_ReadGuiEvent( DCGUI_EXIT_OK, GetList ) }

DCREAD GUI OPTIONS GetOptions CLEAREVENTS FIT ADDBUTTONS MODAL SETAPPWINDOW ;
       to lOk TITLE mess99 EVAL {|o|SetAppFocus(oBrowse:GetColumn(1))}


if lOk
   ret_rec := kt->( recno() )
endif

if ret_rec > 0
   kt->(OrdSetFocus(1))    && Sicherheitshalber
   kt->(dbgoto( ret_rec ))
   IF lMitLock
      do while !nkp->(dbrlock(RecNo()))
      enddo
   ENDIF
   nkp->nka_ts := kt->tnr
   IF lMitLock
      nkp->(dbrunlock(RecNo()))
      nkp->(dbskip(0))
      oCBrowse:refreshCurrent()
      oCBrowse:forcestable()
   ENDIF
endif
DC_GetRefresh( aGetList )
return


Re: DCBROWSECOL EDITOR

Posted: Mon Aug 12, 2013 11:10 am
by rdonnay
Your code and your question are very confusing.

I don't understand what you are asking.

Re: DCBROWSECOL EDITOR

Posted: Mon Aug 12, 2013 12:17 pm
by skiman
Hi,

See the manual for keyblock:
{|mp1,xNil,oXbp|MyFunc(mp1,xNil,oXbp)} where <mp1> is the
numeric value (defined in APPEVENT.CH) of the key pressed and
oXbp is the GET object.

You have to pass your get object, and change the calue of that object in your function you call. If you return from your function, the get must be populated with the data. I think you can use oGet:buffer := "xxx" and oGet:setdata().

Re: DCBROWSECOL EDITOR

Posted: Tue Aug 13, 2013 3:09 am
by Koverhage
Chris,

that worked. Thank you.