PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV 25 → WX - Procedure com indirection para Selecionar registro de uma grid table ou looper
WX - Procedure com indirection para Selecionar registro de uma grid table ou looper
Débuté par BOLLER, 24 juin 2019 20:08 - 1 réponse
Membre enregistré
3 651 messages
Popularité : +175 (223 votes)
Posté le 24 juin 2019 - 20:08
// Summary: <specify the procedure action>
// Syntax:
//[ <Result> = ] UI_SelectRegGrid (<TableName> is string, <ColumnName> is string)
//
// Parameters:
// TableName (ANSI string):
// ColumnName (ANSI string): <specify the role of ColumnName>

// sTipo (ANSI string): <specify the role of sTipo>
Procedure UI_SelectRegGrid(TableName is string, ColumnName is string)

gnidtable is 8-bytes int

nx is int = 0

isTable is int = PositionOccurrence(Upper(TableName),"TABLE",firstRank,FromBeginning)

isLooper is int = PositionOccurrence(Upper(TableName),"LOOPER",firstRank,FromBeginning)

IF isTable > 0 AND isLooper = 0
nx = TableInfoXY({TableName,indControl},tiLineNumber,MouseXPos(),MouseYPos())
ELSE IF isLooper > 0
nx = LooperInfoXY({TableName,indControl},tiLineNumber,MouseXPos(),MouseYPos())
ELSE
nx = TableInfoXY({TableName,indControl},tiLineNumber,MouseXPos(),MouseYPos())
END

IF nx > 0 AND TableName <> "" AND ColumnName <> ""

gnidtable = {TableName,indControl}[nx]+"."+ColumnName

ELSE

gnidtable = 0

END

RESULT gnidtable


--
Adriano José Boller
______________________________________________
Consultor e Representante Oficial da
PcSoft no Brasil
+55 (41) 99949 1800
adrianoboller@gmail.com
skype: adrianoboller
http://wxinformatica.com.br/
Membre enregistré
3 651 messages
Popularité : +175 (223 votes)
Posté le 24 juin 2019 - 20:10
Como usar:

Na table grid do teu projeto coloque no ponto de embed codigo:

gnid = UI_SelectRegGrid("TABLEGRID_F009_APS_PRODUTOS_UNIDADES","COL_F009_PRODUTOS_UNIDADES_ID")


gnid terá o id da chave primária da tabela ou do looper

Isso reduz teu codigo em todo o seu sistema para apenas um código global

Bons estudos!!!

--
Adriano José Boller
______________________________________________
Consultor e Representante Oficial da
PcSoft no Brasil
+55 (41) 99949 1800
adrianoboller@gmail.com
skype: adrianoboller
http://wxinformatica.com.br/