Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: "Karl-Heinz" Newsgroups: comp.lang.clipper.visual-objects Subject: Re: I want to change Iconpushbuttons:usecolor in a for-next loop....how? Date: Thu, 29 Dec 2016 18:01:49 +0100 Lines: 70 Message-ID: References: <_PW8A.209120$Xi4.69838@fx19.fr7> Mime-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original Content-Transfer-Encoding: 8bit X-Trace: individual.net +t6icgX/8HNy08eatxvTCgvuEEPfTm0SS3HdeWSYBTeYHLLFs= Cancel-Lock: sha1:p+cDRB5065zYCZWbMOAE6eg4ZpI= In-Reply-To: <_PW8A.209120$Xi4.69838@fx19.fr7> X-Priority: 3 X-MSMail-Priority: Normal Importance: Normal X-Newsreader: Microsoft Windows Live Mail 16.4.3564.1216 X-MimeOLE: Produced By Microsoft MimeOLE V16.4.3564.1216 Xref: csiph.com comp.lang.clipper.visual-objects:10095 Hi Speedy > I have 34 push buttons I want to change background color on, and I found > the iconpushbuttons LIB > There I can use the following: > > oCCButton1:Usecolor := Brush{Color{COLORGREEN},HATCHSOLID} > > I would like to do this in a for-next loop, but only get errors. > > FOR i := 1 to 34 > IVarGetSelf(self,String2Symbol('oCCButton'+AsString(i):Usecolor)) := > Brush{Color{COLORGREEN},HATCHSOLID} > > NEXT i try calling the attached SymIVarPut() function below from one of your window methods. e.g. aSymControls := ArrayNew ( 34 ) FOR i := 1 UPTO 34 aSymControls [ i ] := String2Symbol ( "BUTTON" + NTrim ( i) ) NEXT SymIVarPut ( SELF , aSymControls , #Usecolor , Brush{Color{COLORGREEN},HATCHSOLID ) BTW. There´s no need to switch the controls from protect to export in the painter. -------------- FUNCTION SymIVarPut ( oWin AS Window , aSymCtrlNames AS ARRAY , symAssignName AS SYMBOL , uValue AS USUAL ) AS VOID PASCAL LOCAL aChildren AS ARRAY LOCAL i , dwLen AS DWORD dwLen := ALen ( aChildren := oWin:GetAllChildren() ) FOR i := 1 UPTO dwLen IF IsAccess ( aChildren [i], #Namesym ) .AND. AScan ( aSymCtrlNames , aChildren [i]:Namesym ) > 0 IVarPut ( aChildren [ i ] , symAssignName , uValue ) ENDIF NEXT RETURN ----------- regards Karl-Heinz