Article ID: 138780
Article Last Modified on 2/10/2000
In Visual FoxPro, a NAME clause has been added to each of the controls created in previous FoxPro versions. The NAME clause creates an object reference for controls created with @ ... GET and @ ... EDIT, allowing you to manipulate the controls with Visual FoxPro properties, events, and methods. The NAME clause provides an intermediate step to upgrade your applications using Visual FoxPro object-oriented programming techniques.
DEFINE WINDOW mywin NAME MyWin; FROM 1,1 TO 30,50 ; FLOAT ; NOCLOSE ; MINIMIZE ; SYSTEM ACTIVATE WINDOW mywin @ 3,5 GET a NAME Text1; SIZE 1.4,15; DEFAULT SPACE(15); PICTURE "@K" @ 3,25 GET b NAME Text2; SIZE 1.4,15; DEFAULT SPACE(15); PICTURE "@K" @ 10,5 GET x Name Button1; PICTURE "@*HN Button 1" ; SIZE 2,10 ; DEFAULT 1 ; STYLE "B" ; VALID Validx() @ 10,25 GET y NAME Button2; PICTURE "@*HN Button 2" ; SIZE 2,10 ; DEFAULT 1 ; STYLE "B" ; VALID Validy() @ 20,15 GET z NAME Button3; PICTURE "@*HN Close" ; SIZE 2,10 ; DEFAULT 1 ; STYLE "B" ; VALID Validz() ** The next four lines of code give the @...GETs for the text boxes ** a 3D look. MyWin.PageFrame1.Page1.Text1.SpecialEffect = 0 MyWin.PageFrame1.Page1.Text2.SpecialEffect = 0 MyWin.PageFrame1.Page1.Text1.BorderStyle = 1 MyWin.PageFrame1.Page1.Text2.BorderStyle = 1 MyWin.Refresh() MyWin.Caption = "Window Caption" && Sets the Title Bar Caption MyWin.PageFrame1.Page1.Text1.Value = "Press Button 1" ** The buttons become part of a command group. The next line of ** code sets the focus to Button1. MyWin.PageFrame1.Page1.Button1.Command1.SetFocus() READ CYCLE RELEASE WINDOW mywin FUNCTION Validx && x VALID ** Changes the values of the text boxes and the captions ** of the command buttons. MyWin.PageFrame1.Page1.Text1.Value = "Thank You" MyWin.PageFrame1.Page1.Text2.Value = "Press Button 2" MyWin.PageFrame1.Page1.Button1.Command1.Caption = "Press 2" MyWin.PageFrame1.Page1.Button2.Command1.Caption = "Button 2" FUNCTION Validy && y VALID ** Changes the values of the text boxes and the captions ** of the command buttons. MyWin.PageFrame1.Page1.Text1.Value = "Press Button 1" MyWin.PageFrame1.Page1.Text2.Value = "Thank You" MyWin.PageFrame1.Page1.Button1.Command1.Caption = "Button 1" MyWin.PageFrame1.Page1.Button2.Command1.Caption = "Press 1" FUNCTION Validz && z VALID CLEAR READ
Additional query words: VFoxWin
Keywords: kbcode KB138780