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


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

Re: List of buttons (controls) in window

Newsgroups comp.lang.clipper.visual-objects
Date 2017-12-06 02:30 -0800
References <011e8257-ff1b-4eb6-a7c1-14462895ecdf@googlegroups.com> <p08emc$1abb$1@gioia.aioe.org>
Message-ID <f84a0c09-153d-430d-9b77-e16523f45ca7@googlegroups.com> (permalink)
Subject Re: List of buttons (controls) in window
From "Grzegorz R." <ramotny64@gmail.com>

Show all headers | View raw


W dniu środa, 6 grudnia 2017 10:53:18 UTC+1 użytkownik Franz Rachbauer napisał:
> 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
> > 
> >

Hi Franz,
thanks for quick reply - I'll surely try it. I was afraid it will be deeper than regular VO.
Are there any other controls beside #BUTTONS that can be identified this way? Link to MS page is enough... (searching IsInstanceOfUsual failed)...

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