[Gambas-user] new user

Doriano Blengino doriano.blengino at ...1909...
Tue Sep 2 09:39:14 CEST 2008


Szenográdi Norbert Péter ha scritto:
> Hi all.
>
> Im a new member on gambas-user-list.
>
> I have some quession:
> - How can I send a datas to other form..
>   
There are two ways.
1 - In the project properties, you can set "Controls of forms are 
public". Once this is done, you can address/refer to controls on other 
forms by their name, i.e. "Form2.label1.text = ....". This option is 
global to the project: all the form have public controls or none.

2 - As each form is a class, it can have public variables and methods. 
You can declare PUBLIC variables and access them from outside the form. 
If you want the form react in some way, this is not enough; after 
setting a variable you must call a public method declared in the form, 
which can manipulate its controls. This can be done in a single step: 
write a public method having some parameter, then call that method 
passing the data you want. That method can use the data you passed and 
do what is needed.

For example, suppose you have a main form which, at some point, opens 
another form as a "status" form. This StatusForm has a Label1 on it, 
showing some message. If controls are public (first solution), then you 
simply write in the main:

    StatusForm.Label1.Text = "Opening data file..."
    WAIT   ' this is required to update instantly the screen

Using the second way runs like this. In the StatusForm code (.class 
file), declare a public method like this:

    PUBLIC SUB UpdateMessage(st AS String)
      Label1.Text = st
      WAIT
    END

At this point, in the main program, you can call: 
StatusForm.UpdateMessage("Opening data file...")

> - How can I see any -manual inserted- data in Tableview and/or
> Gridview..
>   
Look at the manual page about GridView - it contains an example on how 
to set grid "dimensions" (number of row and columns), and fill them by 
code. About to see them... I don't understand the problem; provided that 
the event loop is called, then you will see any data a Gridview is 
filled with.

Email again if you have still problems.






More information about the User mailing list