General information
Title:
Support of @...GET as an object in VFP 6.0
The VFP 6.0 help says the following:
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.
I've read some posts and what-not which say that "_CUROBJ = value" is unreliable or just doesn't work. So what I'm looking for is a way to mix the
@...GET type text box with a sort of OOP methodology to be able to call
SetFocus() for the text boxes.
Has anyone done this before? I only need to do this as a stop-gap becuase the
client I'm working with doesn't want full conversion yet. This is not my idea and I've told them that re-engineering this is the way to go.
The sample code I'm trying to test this with is as follows:
SET TALK OFF
DEFINE WINDOW entry FROM 4,14 TO 14,65 ;
TITLE "Input Window" FLOAT SHADOW SYSTEM COLOR SCHEME 8
ACTIVATE WINDOW entry
DO WHILE .T. &&jem
@ 2,2 SAY "First Name:"
@ 4,2 SAY "Last Name:"
@ 2,16 GET firstname SIZE 1,24 DEFAULT ""
@ 4,16 GET lastname SIZE 1,24 DEFAULT ""
@ 6,14 GET button FUNCTION "*HN \?\ SIZE 1,9,2 DEFAULT "" VALID clearexit()
READ CYCLE OBJECT 1
if readkey(0) = 2
exit
endif
ENDDO && jem
RELEASE WINDOW entry
FUNCTION clearexit
DO CASE
CASE button = "Clear"
firstname = SPACE(10)
lastname = SPACE(10)
@ 7,14 SAY " "
@ 7,34 SAY " "
@ 8,14 SAY " "
@ 8,34 SAY " "
&& _curobj = 1
SHOW GETS
WAIT WINDOW "Enter Name Again" NOWAIT
CASE button = "Exit"
CLEAR READ
WAIT WINDOW "Entry Complete" NOWAIT
ENDCASE
Any help or guidance would be greatly appreciated.
John Martin
VFP Wanna-be
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only