Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.clipper.visual-objects > #10090 > unrolled thread

Re: I want to change Iconpushbuttons:usecolor in a for-next loop....how?

Started byFranz Rachbauer <office@rachbauer.org>
First post2016-12-29 09:20 +0100
Last post2016-12-29 14:59 +0100
Articles 3 — 2 participants

Back to article view | Back to comp.lang.clipper.visual-objects

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: I want to change Iconpushbuttons:usecolor in a for-next loop....how? Franz Rachbauer <office@rachbauer.org> - 2016-12-29 09:20 +0100
    Re: I want to change Iconpushbuttons:usecolor in a for-next loop....how? "Raymond Steffensen" <raymond@up2ng.net> - 2016-12-29 13:18 +0100
      Re: I want to change Iconpushbuttons:usecolor in a for-next loop....how? Franz Rachbauer <office@rachbauer.org> - 2016-12-29 14:59 +0100

#10090 — Re: I want to change Iconpushbuttons:usecolor in a for-next loop....how?

FromFranz Rachbauer <office@rachbauer.org>
Date2016-12-29 09:20 +0100
SubjectRe: I want to change Iconpushbuttons:usecolor in a for-next loop....how?
Message-ID<o42gvi$1e3c$1@gioia.aioe.org>
Hi Raymond,
i'm using the buttons directly to do this color change:

METHOD PostInit() CLASS MyDataWindow
LOCAL aC := SELF:GetControls() AS ARRAY
LOCAL x AS DWORD

FOR x := 1 TO ALen(aC)
	aC[x]:Background := Brush{Color{255, 100, 10}}
NEXT
RETURN SELF

METHOD GetControls() CLASS MyDataWindow
LOCAL aControls     AS ARRAY
LOCAL oC            AS VObject
LOCAL hWnd          AS PTR

hWnd        := GetWindow( SELF:oSurface:Handle(), GW_CHILD )
aControls   := {}
WHILE hWnd != NULL_PTR
	oC      := GetObjectByHandle( hWnd )
	IF IsInstanceOfUsual( oC, #BUTTON )
		AAdd( aControls, oC )
	ENDIF
	hWnd    := GetWindow( hWnd, GW_HWNDNEXT )
ENDDO
RETURN aControls

Regards, Franz

Am 28.12.2016 um 23:15 schrieb Raymond Steffensen:
> Hi
>
> Vo has been in the drawer for quite a few years, and now I start to
> scratch the surface again.
>
> 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
>
> What am I doing wrong?
>
> Regards
> Speedy

[toc] | [next] | [standalone]


#10091

From"Raymond Steffensen" <raymond@up2ng.net>
Date2016-12-29 13:18 +0100
Message-ID<Pa79A.326574$R32.218798@fx28.fr7>
In reply to#10090
Hi Franz, and thanks for that solution.

May I ask how you would change color of only one or few buttons with use of 
a macro?

I need to change color of one or more buttons depending programflow.

Raymond

"Franz Rachbauer"  skrev i nyhetsmeldingen: o42gvi$1e3c$1@gioia.aioe.org ...

Hi Raymond,
i'm using the buttons directly to do this color change:

METHOD PostInit() CLASS MyDataWindow
LOCAL aC := SELF:GetControls() AS ARRAY
LOCAL x AS DWORD

FOR x := 1 TO ALen(aC)
aC[x]:Background := Brush{Color{255, 100, 10}}
NEXT
RETURN SELF

METHOD GetControls() CLASS MyDataWindow
LOCAL aControls     AS ARRAY
LOCAL oC            AS VObject
LOCAL hWnd          AS PTR

hWnd        := GetWindow( SELF:oSurface:Handle(), GW_CHILD )
aControls   := {}
WHILE hWnd != NULL_PTR
oC      := GetObjectByHandle( hWnd )
IF IsInstanceOfUsual( oC, #BUTTON )
AAdd( aControls, oC )
ENDIF
hWnd    := GetWindow( hWnd, GW_HWNDNEXT )
ENDDO
RETURN aControls

Regards, Franz

Am 28.12.2016 um 23:15 schrieb Raymond Steffensen:
> Hi
>
> Vo has been in the drawer for quite a few years, and now I start to
> scratch the surface again.
>
> 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
>
> What am I doing wrong?
>
> Regards
> Speedy 

[toc] | [prev] | [next] | [standalone]


#10098

FromFranz Rachbauer <office@rachbauer.org>
Date2016-12-29 14:59 +0100
Message-ID<o434ru$fda$1@gioia.aioe.org>
In reply to#10091
Hi Raymond,
you can filter these buttons e.g. through name
IF IsInstanceOfUsual( oC, #BUTTON ) .AND.;
    Left(oC:Name,6) == "PSHBTN"	// pshBtn01 thru pshBtn99

or you can mark buttons in field Description in Painter
IF IsInstanceOfUsual( oC, #BUTTON ) .AND.;
    oC:HyperLabel:Description == "XYZ"	// Buttons to be colored

Regards, Franz

Am 29.12.2016 um 13:18 schrieb Raymond Steffensen:
> Hi Franz, and thanks for that solution.
>
> May I ask how you would change color of only one or few buttons with use
> of a macro?
>
> I need to change color of one or more buttons depending programflow.
>
> Raymond
>
> "Franz Rachbauer"  skrev i nyhetsmeldingen: o42gvi$1e3c$1@gioia.aioe.org
> ...
>
> Hi Raymond,
> i'm using the buttons directly to do this color change:
>
> METHOD PostInit() CLASS MyDataWindow
> LOCAL aC := SELF:GetControls() AS ARRAY
> LOCAL x AS DWORD
>
> FOR x := 1 TO ALen(aC)
> aC[x]:Background := Brush{Color{255, 100, 10}}
> NEXT
> RETURN SELF
>
> METHOD GetControls() CLASS MyDataWindow
> LOCAL aControls     AS ARRAY
> LOCAL oC            AS VObject
> LOCAL hWnd          AS PTR
>
> hWnd        := GetWindow( SELF:oSurface:Handle(), GW_CHILD )
> aControls   := {}
> WHILE hWnd != NULL_PTR
> oC      := GetObjectByHandle( hWnd )
> IF IsInstanceOfUsual( oC, #BUTTON )
> AAdd( aControls, oC )
> ENDIF
> hWnd    := GetWindow( hWnd, GW_HWNDNEXT )
> ENDDO
> RETURN aControls
>
> Regards, Franz
>
> Am 28.12.2016 um 23:15 schrieb Raymond Steffensen:
>> Hi
>>
>> Vo has been in the drawer for quite a few years, and now I start to
>> scratch the surface again.
>>
>> 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
>>
>> What am I doing wrong?
>>
>> Regards
>> Speedy
>

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.clipper.visual-objects


csiph-web