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


Groups > comp.lang.clipper.visual-objects > #11216

Re: List of buttons (controls) in window

From Franz Rachbauer <office@rachbauer.org>
Newsgroups comp.lang.clipper.visual-objects
Subject Re: List of buttons (controls) in window
Date 2017-12-06 10:53 +0100
Organization Aioe.org NNTP Server
Message-ID <p08emc$1abb$1@gioia.aioe.org> (permalink)
References <011e8257-ff1b-4eb6-a7c1-14462895ecdf@googlegroups.com>

Show all headers | View raw


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


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