Greetings, I have an old app with forms created using Define Window. Textboxes are created by @ Get. I know many of you will tell me to upgrade which I'm doing but I still need to support the existing app.
Well, here is my question: What is be best way to mimic Setfocus() for a @ Get control? Is this even possible without using the valid clause? My goal is to centralize validation in one place before saving to the dbf.
Thanks, Wayne
--- StripMime Report -- processed MIME parts --- multipart/alternative text/plain (text body -- kept) text/html ---
On 01/06/2016 13:55, Wayne Yeung wrote:
Greetings, I have an old app with forms created using Define Window. Textboxes are created by @ Get. I know many of you will tell me to upgrade which I'm doing but I still need to support the existing app.
Well, here is my question: What is be best way to mimic Setfocus() for a @ Get control? Is this even possible without using the valid clause? My goal is to centralize validation in one place before saving to the dbf.
What you need is _CUROBJ = <expn>
From the help file:
_CUROBJ Example
The following program example demonstrates how GET objects are numbered and how _CUROBJ can be used to return the object number of the current object. Press Tab or the arrow keys to select different objects. Pressing F2 displays the object number for the current object.
CLEAR SET TALK OFF STORE 1 to x, y, z ON KEY LABEL F2 @ 12,2 SAY 'Object # ' + STR(_CUROBJ) && Show # @ 4,2 GET x PICTURE '@*R <Apples;<Oranges;<Limes' && Radio @ 2,2 GET y && Get field @ 8,2 GET z PICTURE '@^ <Pears;<Bananas;<Pineapples' && Popup READ CYCLE ON KEY LABEL F2 && Reset F2 key to default SET TALK ON
This communication is intended for the person or organisation to whom it is addressed. The contents are confidential and may be protected in law. Unauthorised use, copying or disclosure of any of it may be unlawful. If you have received this message in error, please notify us immediately by telephone or email.
www.whisperingsmith.com
Whispering Smith Ltd Head Office:61 Great Ducie Street, Manchester M3 1RR. Tel:0161 831 3700 Fax:0161 831 3715
London Office:17-19 Foley Street, London W1W 6DW Tel:0207 299 7960
Looks like _CUROBJ can only be used within a valid or when. I tried setting _CUROBJ after the READ but nothing happened.
Thanks for the reply Peter. Wayne
On Wed, Jun 1, 2016 at 9:16 AM, Peter Cushing pcushing@whisperingsmith.com wrote:
On 01/06/2016 13:55, Wayne Yeung wrote:
Greetings, I have an old app with forms created using Define Window. Textboxes are created by @ Get. I know many of you will tell me to upgrade which I'm doing but I still need to support the existing app.
Well, here is my question: What is be best way to mimic Setfocus() for a @ Get control? Is this even possible without using the valid clause? My goal is to centralize validation in one place before saving to the dbf.
What you need is _CUROBJ = <expn>
From the help file:
_CUROBJ Example
The following program example demonstrates how GET objects are numbered and how _CUROBJ can be used to return the object number of the current object. Press Tab or the arrow keys to select different objects. Pressing F2 displays the object number for the current object.
CLEAR SET TALK OFF STORE 1 to x, y, z ON KEY LABEL F2 @ 12,2 SAY 'Object # ' + STR(_CUROBJ) && Show # @ 4,2 GET x PICTURE '@*R <Apples;<Oranges;<Limes' && Radio @ 2,2 GET y && Get field @ 8,2 GET z PICTURE '@^ <Pears;<Bananas;<Pineapples' && Popup READ CYCLE ON KEY LABEL F2 && Reset F2 key to default SET TALK ON
This communication is intended for the person or organisation to whom it is addressed. The contents are confidential and may be protected in law. Unauthorised use, copying or disclosure of any of it may be unlawful. If you have received this message in error, please notify us immediately by telephone or email. www.whisperingsmith.com
Whispering Smith Ltd Head Office:61 Great Ducie Street, Manchester M3 1RR. Tel:0161 831 3700 Fax:0161 831 3715 London Office:17-19 Foley Street, London W1W 6DW Tel:0207 299 7960
[excessive quoting removed by server]
On 01/06/2016 14:52, Wayne Yeung wrote:
Looks like _CUROBJ can only be used within a valid or when. I tried setting _CUROBJ after the READ but nothing happened.
Hi Wayne,
You need to set the _CUROBJ in the valid of another object. Usually when something has happened and you want the input to go back to a certain object. If you don't use _curobj to change the order then the read will just move from object No 1 to 2, 3 etc.
Could you expand a little on what you are trying to do and maybe I can suggest something.
Thanks,
Peter
This communication is intended for the person or organisation to whom it is addressed. The contents are confidential and may be protected in law. Unauthorised use, copying or disclosure of any of it may be unlawful. If you have received this message in error, please notify us immediately by telephone or email.
www.whisperingsmith.com
Whispering Smith Ltd Head Office:61 Great Ducie Street, Manchester M3 1RR. Tel:0161 831 3700 Fax:0161 831 3715
London Office:17-19 Foley Street, London W1W 6DW Tel:0207 299 7960
Hi Wayne,
after the READ, there is no more 'event' you can work with (I mean there are no more active GET). So, yes, _curobj can only be set in functions (clauses ?) called from a @GET command. I remember that you can also set the first GET to be active in the READ statement but I don't remember the name of the clause.
If you want to build only one procedure to 'manage' the active GETs, I think you can write your code in the VALID clause of the READ. As long as the valid returns .F., the READ stay active and _curobj is valid.
The Foxil
--- StripMime Report -- processed MIME parts --- multipart/alternative text/plain (text body -- kept) text/html ---
I'm coming to realize that this is not possible but this is what I'm trying to
@ 5,8 say "Effective Date1" @ 5,24 get date1 valid valdate1() @ 7,8 say "Effective Date2" @ 7,24 get date2 valid valdate2()
store " " to yorn @ 9,8 say "Type Y to continue blank to cancel"; color scheme 2 @ 9,50 get yorn; picture '!' read
if PassValidationRules() = .f. setfocus on date2 endif
Do SaveToDB()
I want to do it this way for the following reasons:
-centralize my validation -avoid touching legacy code (valdate1, valdate2) I'm happy to add code but I like to avoid editing existing code -valdate1 and valdate2 does not run if the user hit the escape key
Thanks Wayne
On Wed, Jun 1, 2016 at 10:06 AM, Jean MAURICE jsm.maurice@wanadoo.fr wrote:
Hi Wayne,
after the READ, there is no more 'event' you can work with (I mean there are no more active GET). So, yes, _curobj can only be set in functions (clauses ?) called from a @GET command. I remember that you can also set the first GET to be active in the READ statement but I don't remember the name of the clause.
If you want to build only one procedure to 'manage' the active GETs, I think you can write your code in the VALID clause of the READ. As long as the valid returns .F., the READ stay active and _curobj is valid.
The Foxil
--- StripMime Report -- processed MIME parts --- multipart/alternative text/plain (text body -- kept) text/html
[excessive quoting removed by server]