[Gambas-user] Parsing through all controls of a form
ron
ronstk at ...239...
Thu Jan 19 17:38:05 CET 2006
On Thursday 19 January 2006 15:04, Benoit Minisini wrote:
> On Wednesday 18 January 2006 23:41, johnf wrote:
--8<--
> >
> > John
> >
> > PUBLIC SUB ClearFields(formname AS Window)
> > 'a way to loop thru the controls
> > DIM hControl, tabControl AS Control
> > DIM iNumTabs, imynum AS Integer
> > DIM i AS Integer
> > DIM sNames AS String
> > DIM myVariant AS Variant
> >
> > FOR EACH hControl IN formname.Children
> > IF Object.Class(hControl) = "TextBox" OR Object.Class(hControl) =
--8<--
> > 'editmode(FALSE)
> > 'custno.Enabled = TRUE
> > END
> >
>
> I just finished to implement the pseudo-collection "Window.Controls", that
> will allow you to recursively enumerate all controls on a form.
>
> Your loop will look like:
>
> FOR EACH hControl IN formname.Controls
> ...
> NEXT
>
> You will get it in the next development version release.
>
> Regards,
>
Name collision ???
In the example code a formname as Window ?
Iteration the formname.children, here the children are controls.
Now you made the pseudo-collection "Window.Controls", nice
> Your loop will look like:
>
> FOR EACH hControl IN formname.Controls
or do you mean implement the Form.Controls ?
But why is it then new?
Is this not the same as Form.Children?
The help says for gb.qt.form and gb.qt.window
PROPERTY READ Children AS .ContainerChildren
Returns a collection of each control included in the container.
Maybe a declaration what a form and window means can help.
For me the are almost identical, however I can see the form as the real
object and window as the presentation by a window using X/QT or X/GTK
or kind of textframe using ncurses.
Confused Ron :)
More information about the User
mailing list