[Gambas-user] How can I move "public sub" in other separated files?
Richard
richard.j.walker at ...247...
Sun Jun 27 15:16:16 CEST 2010
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
More information about the User
mailing list