Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.clipper.visual-objects > #11222
| From | Franz Rachbauer <office@rachbauer.org> |
|---|---|
| Newsgroups | comp.lang.clipper.visual-objects |
| Subject | Re: List of buttons (controls) in window |
| Date | 2017-12-06 17:47 +0100 |
| Organization | Aioe.org NNTP Server |
| Message-ID | <p096us$cer$1@gioia.aioe.org> (permalink) |
| References | <011e8257-ff1b-4eb6-a7c1-14462895ecdf@googlegroups.com> <p08emc$1abb$1@gioia.aioe.org> <p091e0$v39$1@news.albasani.net> |
Hi Jamal,
this is a variable way to show/hide controls on any window. I think
Gregory will be delighted. My method only was a cut excerpt of an
extensive base class I often use.
Thanks, Franz
Am 06.12.2017 um 16:13 schrieb Jamal:
> Hi Franz,
>
> Instead of hard coding the type of controls. I think your method (for
> fun; not tested) can be changed to a function like:
>
>
> FUNCTION GetDataWindowControls(oOwner as OBJECT, symClassType AS SYMBOL)
> AS ARRAY PASCAL
> LOCAL aControls AS ARRAY
> LOCAL oC AS VObject
> LOCAL hWnd AS PTR
>
> hWnd := GetWindow( oOwner :oSurface:Handle(), GW_CHILD )
> aControls := {}
>
> WHILE hWnd != NULL_PTR
> oC := GetObjectByHandle( hWnd )
> IF IsInstanceOfUsual( oC, symClassType )
> AAdd( aControls, oC )
> ENDIF
>
> hWnd := GetWindow( hWnd, GW_HWNDNEXT )
>
> ENDDO
>
> RETURN aControls
>
> Then it call as:
>
> aButtons := GetDataWindowControls(SELF, #BUTTON)
> aSingleLineEdits := GetDataWindowControls(SELF, #SINGLELINEEDIT)
>
> FUNCTION HideControls(oOwner as OBJECT, aControls AS OBJECT, lHide as
> LOGIC) AS VOID PASCAL
> LOCAL dwLength := ALen(aControls) as DWORD
> LOCAL j as DWORD
>
> FOR j = 1 upto dwLength
> if lHide
> oOwner:aControls[j].Hide()
> else
> oOwner:aControls[j].Show()
> endif
> NEXT
>
> RETURN
>
> Samples:
>
> HideControls(self, aButtons, true)
>
> HideControls(SELF, GetDataWindowControls(SELF, #BUTTON), TRUE)
> // one call
>
> etc
>
> Jamal
>
>
> "Franz Rachbauer" wrote in message news:p08emc$1abb$1@gioia.aioe.org...
>
> Hi Gregory,
> I use the following to get the controls I need:
>
> METHOD GetControls() CLASS RedimDataWindow
> 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
>
> Then I have an array of Buttons which I can hide/disable like
> aControls[nVal]:Hide()
>
> Regards, Franz
>
> Am 06.12.2017 um 09:41 schrieb Grzegorz R.:
>> Hello Friends
>>
>> I need to enable/disable and/or make readonly true/false some controls
>> on my window but there is a lot of them and listing explicitly
>> requires a lot of writing/coding.
>>
>> I can easily change state of SINGLELINEEDITs with:
>>
>> CLASS MyEdit INHERIT SINGLELINEEDIT
>> ...
>> METHOD ChgState(lFlag) CLASS MyEdit
>> SELF:ReadOnly:=lFlag
>> RETURN NIL
>> ...
>> // TestWin has SINGLEEDITLINES that inherit from MyEdit
>>
>> METHOD SetState(lFlag) CLASS TestWin
>> LOCAL I AS DWORD
>> FOR I:=1 UPTO ALen(SELF:aControls)
>> IF IsMethod(SELF:aControls[I],#CHGSTATE)
>> SELF:aControls[I]:ChgState(lControlsState)
>> ENDIF
>> NEXT RETURN NIL
>>
>> However aControls does not include pushbuttons (and maybe other
>> controls).
>>
>> How can I do the same ie. get list of existing pushbuttons (and other
>> controls not included in aControls) in window and process them in loop?
>> Or maybe another way exist to change state (enable/disable) a bunch of
>> different types of controls?
>>
>> Best regards
>> Gregory
>>
>>
Back to comp.lang.clipper.visual-objects | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
List of buttons (controls) in window "Grzegorz R." <ramotny64@gmail.com> - 2017-12-06 00:41 -0800
Re: List of buttons (controls) in window Franz Rachbauer <office@rachbauer.org> - 2017-12-06 10:53 +0100
Re: List of buttons (controls) in window "Grzegorz R." <ramotny64@gmail.com> - 2017-12-06 02:30 -0800
Re: List of buttons (controls) in window Franz Rachbauer <office@rachbauer.org> - 2017-12-06 14:19 +0100
Re: List of buttons (controls) in window "Jamal" <noooospam@example.com> - 2017-12-06 10:13 -0500
Re: List of buttons (controls) in window Franz Rachbauer <office@rachbauer.org> - 2017-12-06 17:47 +0100
Re: List of buttons (controls) in window "Grzegorz R." <ramotny64@gmail.com> - 2017-12-06 12:29 -0800
Re: List of buttons (controls) in window Franz Rachbauer <office@rachbauer.org> - 2017-12-07 09:34 +0100
Re: List of buttons (controls) in window "Karl-Heinz" <invalid@invalid.invalid> - 2017-12-10 11:32 +0100
csiph-web