[Gambas-user] How can I move "public sub" in other separated files?
Simone Gentili
sensorario at ...626...
Sun Jun 27 23:20:20 CEST 2010
Thanks a lot!!!
Now I've main file:
' Gambas class file
PUBLIC SUB _new()
Tastiera.disegnaLableChitarra(ME)
Tastiera.disegnaTastieraChitarra(ME)
END
and a module named "tastiera" with these two sub
' Gambas module file
PUBLIC SUB disegnaTastieraChitarra(form AS Form)
DIM hButton AS Button
DIM i AS Integer
DIM j AS Integer
FOR i = 1 TO 24
FOR j = 1 TO 6
hButton = NEW Button(form) AS "Ilmiopulsante" & i
hButton.Top = 20 * j + 200
hButton.Left = 20 * i
hButton.H = 20
hButton.W = 20
hButton.Caption = i
NEXT
NEXT
END
PUBLIC SUB disegnaLableChitarra(form AS Form)
DIM lableChitarra AS Label
lableChitarra = NEW Label(form) AS "MiaLable"
lableChitarra.Text = "La Chitarra"
lableChitarra.Caption = "La Chitarra"
lableChitarra.H = 33
lableChitarra.W = 44
END
On Sun, Jun 27, 2010 at 3:16 PM, Richard <richard.j.walker at ...247...>wrote:
> On Sunday 27 June 2010 13:46:29 Simone Gentili wrote:
> > This is my "main" program.
> >
> > PUBLIC SUB _new()
> > disegnaLableChitarra()
> > disegnaTastieraChitarra()
> > END
> >
> >
> > These are two subroutines but I want to have them in separated file. What
> I
> > have to do?
> > PUBLIC SUB disegnaLableChitarra()
> > DIM lableChitarra AS Label
> > lableChitarra = NEW Label(ME) AS "MiaLable"
> > lableChitarra.Text = "La Chitarra"
> > lableChitarra.Caption = "La Chitarra"
> > lableChitarra.H = 33
> > lableChitarra.W = 44
> > END
> >
> > PUBLIC SUB disegnaTastieraChitarra()
> > DIM hButton AS Button
> > DIM i AS Integer
> > DIM j AS Integer
> > FOR i = 1 TO 24
> > FOR j = 1 TO 6
> > hButton = NEW Button(ME) AS "Ilmiopulsante" & i
> > hButton.Top = 20 * j + 200
> > hButton.Left = 20 * i
> > hButton.H = 20
> > hButton.W = 20
> > hButton.Caption = i
> > NEXT
> > NEXT
> > END
> >
> ---------------------------------------------------------------------------
> >--- This SF.net email is sponsored by Sprint
> > What will you do first with EVO, the first 4G phone?
> > Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
> > _______________________________________________
> > Gambas-user mailing list
> > Gambas-user at lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/gambas-user
>
> Hi Simone,
> My guess is that you might want to use a separate Module file for routines
> or
> variables you want to group together.
>
> Other choices might include creating a Class file to organise bits which
> are
> logically related.
>
> Looking more closely at your code, it is perhaps most useful to use the
> Gambas
> IDE to build the widgets you need on a form and set all the relevant
> properties property sheet and tweak them in the form's class file.
>
> If it is your intention to dynamically alter widget properties as the
> program
> runs then any of these approaches should be usable, but bear in mind
> that "public" visibility of module symbols and form controls is a
> project-wide configuration available from the IDE Project->Properties menu;
> look at the "Options" tab. It is off by default for symbols and controls.
>
>
> Richard
>
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by Sprint
> What will you do first with EVO, the first 4G phone?
> Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
--
-demo
Links:
http://www.unodeitanti.com
http://www.facebook.com/simone.gentili
http://twitter.com/sensorario
http://knottyboybox.blogspot.com/
http://www.travian.it/?uc=it10_5825
IM:
skype: rastagnolo
ICQ - 55493398
MSN - knottyboy at ...2452...
More information about the User
mailing list