How to Add Multiple Properties When You Add ObjectsLast reviewed: April 30, 1996Article ID: Q129205 |
The information in this article applies to:
SUMMARYThis article shows by example how to:
MORE INFORMATION
Example OneYou can specify multiple properties of an added object within the Class definition by using the WITH clause. WITH...ENDWITH, however, is not valid within a Class definition and will result in an error.
** Start of Example One MyNewForm=CREATE("frmForm") MyNewForm.Show READ EVENTS DEFINE CLASS frmForm AS Form Visible = .T. Left = 50 Top = 30 ADD OBJECT MyQuitButton AS cmdQuitButton WITH ; Left = 30, ; Top = 30, ; Height = 60, ; Width = 100, ; Caption = "Quit" ENDDEFINE DEFINE CLASS cmdQuitButton AS CommandButton PROCEDURE Click RELEASE ThisForm CLEAR EVENTS ENDPROC ENDDEFINE ** Note: Without the semicolons and commas in the ADD OBJECT ... WITH ** clause, error messages will occur such as "Unrecognized command ** verb" and "Command contains unrecognized phrase/keyword." Example TwoThis example shows how to use AddObject method with the WITH...ENDWITH clause to specify multiple properties for the object.
** Start of Example Two frmForm = CREATEOBJECT("Form") WITH frmForm .Visible = .T. .ScaleMode = 3 .AddObject("pgfPageFrame", "PageFrame") WITH .pgfPageFrame .Visible = .T. .PageCount = 2 .Left = 50 .Top = 20 .Height = 200 .Width = 250 ENDWITH ENDWITH ** The WITH...ENDWITH may be used to specify properties of the object ** by pointing to the parent, which is the container in this case. WITH frmForm.pgfPageFrame .PageCount = 3 ENDWITH READ EVENTS |
Additional reference words: 3.00 VFoxWin
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |