DCBROWSE DATALINK and dc_getrefresh() issue

This forum is for eXpress++ general support.
Post Reply
Message
Author
Maxz
Posts: 49
Joined: Sun Jan 09, 2022 12:11 pm

DCBROWSE DATALINK and dc_getrefresh() issue

#1 Post by Maxz »

I need to use the keyboard to automatically position myself in the browse, validating the last field of the GET, like in this example:

nLevelMenu:=1
@ x,y DCSAY "...." GET ...
@ x,y DCSAY "...." GET ...
@ x,y DCSAY "Code" GET mCode GETOBJECT omCode;
VALID {|| IS_FOUND(mCode) } ;
WHEN { || nLevelMenu==1 } SAYOPTION XBPSTATIC_TEXT_VCENTER ;
KEYBLOCK {|n,x,o|IIF(n==xbeK_ENTER, Actions("browse_activated",GetList) ,NIL) } // LAST GET = Confirm


@ x,y DCBROWSE oBrowse SIZE 120,22 ID "BROWSE" ;
WHEN { || nLevelMenu==2 } ;
CURSORMODE XBPBRW_CURSOR_NONE ALIAS "database" ;
DATALINK {||CHANGE_REC(GetList)} NOSIZECOLS


//----------------------


STATIC FUNCTION Actions (cMode,oGetList)
DO CASE
CASE cScelta=="browse_activated" // switch to browse mode

// Refresh current browse with data
SELECT("database")
SEEK mCode
SET SCOPE TO mCode
DBGOTOP()
SetAppFocus(oBrowse)
oBrowse:cursorMode:= XBPBRW_CURSOR_ROW
oBrowse:configure()
oBrowse:RefreshAll()
oBrowse:forceStable()

nLevelMenu:=2 // switch mode

dc_clearevents() // <---------------- for safety I delete all events in the queue

dc_getrefresh(oGetList,,,,,.F.)
// from dc_getrefresh manual
// exclude If <lDataLink> is .TRUE. (default) any code blocks associated
// with the DATALINK clause of DC* commands will also be evaluated
// when the associated object is refreshed. If <lDataLink> is
// .FALSE. then the DATALINK code block is ignored during refresh.

ENDCASE
RETURN nil


as a result, a ENTER is automatically executed on the DATALINK of the browse plus the function CHANGE_REC() as if I had given another send

Post Reply