[Gambas-user] Re: Gambas-user digest, Vol 1 #1758 - 16 msgs

wspinto at ...1405... wspinto at ...1405...
Mon Mar 20 20:02:13 CET 2006


> Message: 16
> Date: Mon, 20 Mar 2006 06:51:23 -0800 (PST)
> From: Christopher Brian Jack <brian at ...1334...>
> To: Gambas-Users List <gambas-user at lists.sourceforge.net>
> Subject: [Gambas-user] Form enumeration
> Reply-To: gambas-user at lists.sourceforge.net
>
>
> I'm having difficulty trying to write a sub that will close all open forms
> except the caller (it's intended that the caller be a Form most likely
> calling from his myform_Close handler and the all-but-the-caller is there
> to avoid endless loop condition)
>
> so in a module called "Common" I define the function
>
> from a Form's myform_Close handler he makes a call like this
>
> PUBLIC SUB myform_Close
>   Common.CloseAllForms(ME)
>   ME.Close()
> END
>
> In Common:
>
> PUBLIC SUB CloseAllForms(who as Object)
>   DIM which AS String
>   FOR EACH which IN ["Form1","Form2",...,"FormN"]
>     IF NOT (which=Object.Class(who)) THEN
>       'need to get object-from-string-in-which and use
>       'Object.Call(resultingObject,"Close")
>     END IF
>   NEXT
> END
>
> The trouble I'm running into is that it does not appear that there is a
> way to get back an object, given its string name.  I've tried the Class
> "array" --ie: Object.Call(Class(which),"Close")-- but it gives an error.
>
> I'm at a stumbling block here, any suggestions?
>
> .=================================================.
> |  Christopher BRIAN Jack aka "Gau of the Veldt"  |
> +================================================='
> | brian _AT_ brians-anime _DOT_ com
> `=================================================-
> Hi Spambots, my email address is sputnik at ...1334...
>
>
>
> --__--__--
>
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
>
> End of Gambas-user Digest
>
>

Hi Christopher BRIAN!
I'm using this sub to close forms.

PUBLIC SUB FimProg()
    DIM ppp AS Window

    '* Close All Windows exept TELAPRIN
    FOR EACH ppp IN Windows
        IF UCase$(Trim(ppp.Tag)) <> "TELAPRIN" THEN
            ppp.Close
        END IF
    NEXT
END

___________________________________________________________________________________
Tarifa Única DDI - A melhor opção para suas ligações internacionais. 
Do fixo ou do celular você paga a mesma tarifa e ainda tem um desconto
especial para ligar para os Estados Unidos.
Saiba mais. Acesse www.embratel.com.br





More information about the User mailing list