[Gambas-user] How to return a event from an embedded sub form

Fabien Bodard gambas.fr at ...626...
Mon Aug 26 22:57:11 CEST 2013


never use public control
insteed in the embedded form add



Public Function GetButton() as Button
  return btnOk
end



2013/8/26 Tobias Boege <taboege at ...626...>

> On Mon, 26 Aug 2013, Marty wrote:
> > Hello,
> >
> > I need to return a button click from an embedded sub form. I managed to
> > get the sub form embedded in the main form using the code found in the
> > tips that run when Gambas loads.
> >
> > The sub form has a button called OK. I want to capture the btnOK_Click
> > event and use it in the main form. I know I can use a global variable
> > that can be seen by both forms but, I'd like to use another method. I've
> > been trying Object.Attach as suggested by Benoit in an email I found on
> > the net. I've not been able to get that working.
> >
> > Would you help me with the syntax of Object.Attach or suggest a better
> > approach? I am still learning Gambas syntax so please do not assume
> > anything when sending code examples.
> >
>
> Make your Button on the embedded Form public in the form editor in the IDE.
> Let the Button be btnOK and an instance of your embedded Form be
> "hEmbedded". Then you can do the following in FMain:
>
> Object.Attach(hEmbedded.btnOK, Me, "btnOK")
>
> This will attach the Button btnOK on the embedded Form to FMain. The Button
> gets "btnOK" as its event name and will then raise btnOK_Click() in FMain.
>
> Regards,
> Tobi
>
>
> ------------------------------------------------------------------------------
> Introducing Performance Central, a new site from SourceForge and
> AppDynamics. Performance Central is your source for news, insights,
> analysis and resources for efficient Application Performance Management.
> Visit us today!
> http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>



-- 
Fabien Bodard



More information about the User mailing list