[Gambas-user] control groups

Eldon Eller eeller at ...826...
Mon Dec 4 19:08:22 CET 2006


Many thanks to all of you have helped. I certainly should be able to 
take it from here. EEE

timothy wrote:
>   
>> -----Original Message-----
>> From: gambas-user-bounces at lists.sourceforge.net [mailto:gambas-user-
>> bounces at lists.sourceforge.net] On Behalf Of Stefano Palmeri
>> Sent: 04 December 2006 08:14
>> To: mailing list for gambas users
>> Subject: Re: [Gambas-user] control groups
>>
>> Alle 08:12, lunedì 4 dicembre 2006, Eldon Eller ha scritto:
>>     
>>> Yes, I know that control groups don't work with FOR EACH. What I am
>>> looking for is a way to do what FOR EACH would do if it did work. In
>>> short, to look at each control in the control group and determine
>>>       
> its
>   
>>> properties so I can take some action based on those properties. For
>>> example, if the control is a button and the button text is "foo"
>>>       
> then
>   
>>> change the foreground to red. Please forgive my inability to
>>> communicate, but please don't give up on me. Tnx, EEE
>>>
>>> Christopher Brian Jack wrote:
>>>       
>>>> On Sun, 3 Dec 2006, Eldon Eller wrote:
>>>>
>>>>
>>>>         
>>>>> Sorry, I did not state my problem clearly. What I want to do is
>>>>> something like this (which does not work):
>>>>> FOR EACH button IN dates
>>>>>     if button.SomeProperty = Something then do SomeSub
>>>>> NEXT
>>>>>
>>>>>           
>>>> Control groups don't work with FOR EACH.
>>>>         
>> See the code of attached example. Change "combobox" with "button".
>> I'm sure there's a more elegant way to do what you're asking for, but
>> this a working starting point.
>>
>> Regards,
>>
>> Stefano Palmeri
>>
>>     
>
> It is better to use Object.Is() or Object.Type() as in the following
> example:
>
> PUBLIC SUB Form_Open()
>   DIM ctrl AS Control
>   ' Use Is to test the control type
>   FOR EACH ctrl IN ME.Children
>     IF Object.Is(ctrl, "ComboBox")
>       PRINT ctrl.Name & " is a ComboBox"
>     END IF
>   NEXT 
>   ' Or use type to find the control
>   FOR EACH ctrl IN ME.Children
>     SELECT Object.Type(ctrl)
>       CASE "Button"
>         PRINT ctrl.Name & " is a Button"
>       CASE "ComboBox"  
>         PRINT ctrl.Name & " is a ComboBox"
>       DEFAULT 
>         PRINT ctrl.Name & " a " & Object.Type(ctrl) & " is not wanted"
>     END SELECT 
>   NEXT 
> END 
>
> Also you may as well iterate using the Control type (and not Object).
> This gives you access to more properties. All controls on you form will
> inherit from Control anyway. This is also shown in the above example.
>
> Thanks
>
> 8-{)} Timothy Marshal-Nichols
> <mailto: timothy.marshal-nichols at ...247...>
>
>
>
>
>
>
>
>
>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys - and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
>   




More information about the User mailing list