Nesse exemplo explicamos na pratica como usar o comando gpwEnumCotrol
VIDEO
https://www.youtube.com/watch?v=7po-Sar1t6o
Segue o codigo fonte
// Summary: <specify the procedure action>
// Syntax:
//[ <Result> = ] MeuGroupWare (<minhajanela>)
//
// Parameters:
// minhajanela: <specify the role of minhajanela>
// Example:
// <Specify a usage example>
//
// Return value:
PROCEDURE MeuGroupWare(minhajanela)
i is int = 1
objs_form is string = ""
sControlName is string = ""
NomeForm is string = minhajanela
arrayControles.DeleteAll()
WHEN EXCEPTION IN
sControlName = gpwEnumControl(NomeForm, i) //CORACAO DO GROUPWARE
indirection is string = NoSpace(NomeForm) +"."+ NoSpace(sControlName)
Add(arrayControles,indirection)
LOOP(5000)
// Next control
i++
sControlName = gpwEnumControl(NomeForm, i)
IF sControlName <> ""
indirection = NoSpace(NomeForm) +"."+ NoSpace(sControlName)
Add(arrayControles,indirection)
HReset(elementos)
IF HReadSeek(elementos,nome,indirection,hIdentical)=False THEN
elementos.nome = indirection
elementos.janela = NomeForm
elementos.nomeamigavel = ExtractString(indirection,2,TAB,FromEnd)
elementos.nomejanelaamigavel = {NomeForm}..Caption
HAdd(elementos)
END
Trace(indirection)
ELSE
BREAK
END
END
RESULT arrayControles
DO
IF ExceptionInfo(errCode) THEN
RESULT arrayControles
END
END
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Summary: <specify the procedure action>
// Syntax:
//seTemAcesso (<nomejanela>, <gnUserid>)
//
// Parameters:
// nomejanela:
// gnUserid: <specify the role of gnUserid>
// Example:
// <Specify a usage example>
//
PROCEDURE seTemAcesso(gsNomejanela,gnUserid)
FOR EACH elementos
IF elementos.janela = gsNomejanela
HReset(usuarioxelementos)
IF HReadSeek(usuarioxelementos,chavecomposta,[gnUserid,elementos.elementoid],hIdentical) = True THEN
//1 - Active
//2 - DisplayOnly
//3 - Grayed
//4 - ReadOnlyNoSelection
//5 - OutsideScreen
indirection is string = ExtractString(elementos.nome,1,TAB,FromBeginning)
SWITCH usuarioxelementos.status
CASE 1
{indirection}..State = Active
CASE 2
{indirection}..State = DisplayOnly
CASE 3
{indirection}..State = Grayed
CASE 4
{indirection}..State = ReadOnlyNoSelection
CASE 5
IF StringCount(indirection,"BTN",IgnoreCase) = 0
{indirection}..State = OutsideScreen
ELSE
{indirection}..Visible = False
END
CASE 6
{indirection}..Visible = True
CASE 7
{indirection}..Visible = False
OTHER CASE
{indirection}..State = DisplayOnly
END
END
END
END
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Como usar?
No open da janela:
//////////////////////////////
gnUser is int = 1 //silvio
MeuGroupWare(MyWindow..Name)
seTemAcesso(MyWindow..Name,gnUser)