Page 1 of 1

several get's in a loop

Posted: Wed Nov 23, 2016 9:48 pm
by plantenkennis
Hello Antonio,

I use the CreatBlock function for some FOR-Next loops to build screens. Now I want to use it to get the value of several get properties in a loop. However I don't get this to work. Any suggestions? Here is what I use now:

Code: Select all

PUBLIC aGegevenTekst[0][2]

AADD(aGegevenTekst, {'bloemkleur', ''})
AADD(aGegevenTekst, {'kleur kelk', ''})
AADD(aGegevenTekst, {'kleur kroon', ''})
AADD(aGegevenTekst, {'bloeivorm', ''})
AADD(aGegevenTekst, {'bloeitijd', ''})
AADD(aGegevenTekst, {'hoogte', ''})
AADD(aGegevenTekst, {'hoogte na 10 jr', ''})
AADD(aGegevenTekst, {'hoogte na 25 jr', ''})
AADD(aGegevenTekst, {'hoogte blad', ''})
AADD(aGegevenTekst, {'hoogte bloem', ''})
AADD(aGegevenTekst, {'breedte', ''})
AADD(aGegevenTekst, {'groeiwijze', ''})
AADD(aGegevenTekst, {'blad/loof', ''})


    nRowPaint := 325
    nColumn := 0
    FOR n = 1 TO 13
        oGetName := 'oGetFilter' + ALLTRIM(STR(n))
        cGetVar := aGegevenTekst[n,2]
        @ nRowPaint, nColumn SAY oSay PROMPT aGegevenTekst[n,1] OF oFld:aDialogs[ 2 ] SIZE 100, 20
            oSay:SetAlign( 1 )
        @ nRowPaint, nColumn+105 GET &oGetName VAR cGetVar OF oFld:aDialogs[ 2 ] SIZE 200, 20
            &oGetName:bChanged := CreateBlock( oGetName )
        nRowPaint := nRowPaint - 25
    NEXT


*************************************************

FUNCTION CreateBlock( cName )

RETURN { || RK_ChangeGegevenSelect( cName ) }


*************************************************

FUNCTION RK_ChangeGegevenSelect(cName)

LOCAL nGegeven := VAL(SUBSTR(cName, 11))
MsgInfo(cName)
aGegevenTekst[nGegeven,2] := cName:GetText

RETURN

 


Greetings,

René

Re: several get's in a loop

Posted: Thu Nov 24, 2016 10:34 am
by Antonio Linares
René,

AEval( oDlg:aControls, { | oControl | If( Upper( oControl:ClassName() ) == "TGET", save oControl:GetText(), nil ) } )

Re: several get's in a loop

Posted: Thu Nov 24, 2016 7:32 pm
by plantenkennis
Hello Antonio,

As I understand all defined classes are in an array. But how looks this array, is there an example anywhere?
If I ask:
oFld:aDialogs[2]:aControls[n]:ClassName()
, I get all classnames, but how to retrieve the name of the class (Like oGet1, oGet2...)

Rene

Re: several get's in a loop

Posted: Thu Nov 24, 2016 10:22 pm
by Antonio Linares
René,

> I get all classnames, but how to retrieve the name of the class (Like oGet1, oGet2...)

If you mean the name of the object:

oControl:cVarName

if you mean its class name:

oControl:ClassName()