[Gambas-user] Crssed interexchange between forms
Richard
richard.j.walker at ...247...
Sat Mar 29 14:18:02 CET 2008
As an alternative to Rob's suggestion that you make all form controls public
(which should work) you might prefer to create public methods on your forms
which will take a parameter from the calling form code and store the value in
a now local form control property.
For example; if on frmCW you have
PUBLIC SUB Write_CWcall_text(calltext as string)
CWCall.text = calltext
END SUB
then on FMain you would write
IF cw_on THEN FrmCW.Write_CWcall_text(Call.Text)
That should also do the trick and preserve flexibility. If form controls are
public then you can write directly to them from ANYWHERE. What if you decide
to change the control from a text box to a value box? You would have to go
through all your code and change all the writes and reads involving the
changed control.
If instead you do it as I suggest, then you only need to change the access
methods for READ and WRITE in one place. Much easier, yes?
Richard
On Friday 28 Mar 2008 18:04, Pino Zollo wrote:
> I am developing a program in GAMBAS2 2.0
>
> How can I pass information between one form and another ?
>
> In my program there are 3 forms....FMain, FrmCW e FCluster.
>
> >From the class of FrmCW (or of Fcluster) I can write a value in
>
> FMain.variabile....
> But nither from FMain and from FCluster can write variabes in
> FrmCW.somevariable.
>
> It means that the class of FMain can not send values to the variables of
> other classes , nither a class (not FMain) can send values to other classes
> which are not FMain ...Why this ?
>
> It seems a big limitation.
> For instance...in FMain the instruction:
>
> IF cw_on THEN FrmCW.CWCall.text = Call.Text
>
> Simply does nothing...nither gives error.
>
> In the class of FCluster
> FMain.Call.Text = GridSpot[GridSpot.row, 0].Text ' <-- this is ok
> IF FMain.cw_on THEN FrmCW.CWCall.text = GridSpot[GridSpot.row, 0].Text '
> <--
>
> The first instruction works, but the second does nothing.
>
> Why ?
>
> Is there some trick or workaround ?
>
> For the same reason, I guess, it does not even work the example in
> suggestion #11.
>
> the instruction
>
> hSuperControl.Move(8, 8, 128, 64)
>
> if given into the FMain class gives error..."Not enough parameters"
>
> >From a class not-FMain I can call SUBs of FMain, but not viceversa
>
> Equally from a class not-FMain I can not call SUBs of not-FMain
>
> Thanks for any help
>
> Pino pinozollo at ...626...
>
>
>
> -------------------------------------------------------------------------
> Check out the new SourceForge.net Marketplace.
> It's the best place to buy or sell services for
> just about anything Open Source.
> http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplac
>e _______________________________________________
> 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