EXIT BUTTON VALIDATION
Moderator: Rathinagiri
-
- Posts: 21
- Joined: Fri Aug 30, 2013 5:38 am
EXIT BUTTON VALIDATION
Dear Sir,
I have started to work in HMG. Kindly help me. I have set validation for Company Code & Company Name and when I press Exit Button it is going on validation of
Company Code because focus is on CC TextBox. Kindly suggest me what coding will be done. I am attaching test.prg for you. and also guide me for better codeing.
I have started to work in HMG. Kindly help me. I have set validation for Company Code & Company Name and when I press Exit Button it is going on validation of
Company Code because focus is on CC TextBox. Kindly suggest me what coding will be done. I am attaching test.prg for you. and also guide me for better codeing.
- Attachments
-
- TEST.ZIP
- (1.24 KiB) Downloaded 288 times
-
- Posts: 1275
- Joined: Tue Sep 03, 2013 4:22 am
- Location: Tecámac, México
Re: EXIT BUTTON VALIDATION
Hello
In my opinion you are doing things a little difficult, since HMG and is a bit more friendly.
I find that when looking for the key to the company not doing it for index, I think you should create an index for the search is fast and effective.
I see you're back to validate the name, you just have to do a search, either by a single field or field compound (two or more key fields name). I think in your example should only be by CODE and the name alone bring it to the database and put it in the textbox name.
And you must open and close the databases in each function, Habren and close only once.
The structure of your program must have the following structure +o-:
# include "hmg.ch"
# define TRUE. T.
Function main ()
Local hWnd
Public nWCrt: = GetDesktopWidth ()
SET EXCLUSIVE OFF
REQUEST HB_LANG_ES / / that the cancellation error messages or display them in Castilian me
REQUEST DBFCDX
RddSetDefault ("DBFCDX")
DEFINE WINDOW Win_Prin;
AT 0.0;
WIDTH 307;
HEIGHT 147;
TITLE 'SYSTEM';
ICON "LOGO";
BACKCOLOR {0,0,255};
MAIN;
ON INIT (BasesOpen ()) / / OPEN THE BASIS FOR UNIQUE OPPORTUNITY
ON RELEASE (BasesClose ()) / / CLOSE THE BASIS FOR UNIQUE OPPORTUNITY
DEFINE TEXTBOX text_1
ROW 10
COL 140
........
END TEXTBOX
END WINDOW
WINDOW CENTER Win_Prin
ACTIVATE WINDOW Win_Prin
ENDIF
RETURN
ADVISE YOU THAT:
1. - JUST OPEN YOUR DBFs E RATIOS NTX or CDX ONCE
2. - You referred FOR THEM TO "SELECT" ..... ETC.
3. - BE IS ORDERED, A TEACHER TOLD ME, "MAKE THINGS FOR FOOLS" (understandable MOST ANYTHING YOU CAN).
PS: I am also beginner but this has helped me.
PRG DOS COMMAND YOU FOUND THAT ONE OF THE TOPICS AND I HAVE SERVED AS A GUIDE.
In my opinion you are doing things a little difficult, since HMG and is a bit more friendly.
I find that when looking for the key to the company not doing it for index, I think you should create an index for the search is fast and effective.
I see you're back to validate the name, you just have to do a search, either by a single field or field compound (two or more key fields name). I think in your example should only be by CODE and the name alone bring it to the database and put it in the textbox name.
And you must open and close the databases in each function, Habren and close only once.
The structure of your program must have the following structure +o-:
# include "hmg.ch"
# define TRUE. T.
Function main ()
Local hWnd
Public nWCrt: = GetDesktopWidth ()
SET EXCLUSIVE OFF
REQUEST HB_LANG_ES / / that the cancellation error messages or display them in Castilian me
REQUEST DBFCDX
RddSetDefault ("DBFCDX")
DEFINE WINDOW Win_Prin;
AT 0.0;
WIDTH 307;
HEIGHT 147;
TITLE 'SYSTEM';
ICON "LOGO";
BACKCOLOR {0,0,255};
MAIN;
ON INIT (BasesOpen ()) / / OPEN THE BASIS FOR UNIQUE OPPORTUNITY
ON RELEASE (BasesClose ()) / / CLOSE THE BASIS FOR UNIQUE OPPORTUNITY
DEFINE TEXTBOX text_1
ROW 10
COL 140
........
END TEXTBOX
END WINDOW
WINDOW CENTER Win_Prin
ACTIVATE WINDOW Win_Prin
ENDIF
RETURN
ADVISE YOU THAT:
1. - JUST OPEN YOUR DBFs E RATIOS NTX or CDX ONCE
2. - You referred FOR THEM TO "SELECT" ..... ETC.
3. - BE IS ORDERED, A TEACHER TOLD ME, "MAKE THINGS FOR FOOLS" (understandable MOST ANYTHING YOU CAN).
PS: I am also beginner but this has helped me.
PRG DOS COMMAND YOU FOUND THAT ONE OF THE TOPICS AND I HAVE SERVED AS A GUIDE.
-
- Posts: 1275
- Joined: Tue Sep 03, 2013 4:22 am
- Location: Tecámac, México
-
- Posts: 1275
- Joined: Tue Sep 03, 2013 4:22 am
- Location: Tecámac, México
Re: EXIT BUTTON VALIDATION
Change logic of ON LOSTFOCUS validation
Simple way is validate during saving of data
Either
Send data file along with .prg
Simple way is validate during saving of data
Either
Send data file along with .prg
BPD
Convert Dream into Reality through HMG
Convert Dream into Reality through HMG
- esgici
- Posts: 4543
- Joined: Wed Jul 30, 2008 9:17 pm
- DBs Used: DBF
- Location: iskenderun / Turkiye
- Contact:
Re: EXIT BUTTON VALIDATION
I agree with Dave (bpd2000);bpd2000 wrote:Change logic of ON LOSTFOCUS validation
Simple way is validate during saving of data
Either
Send data file along with .prg
Simple ways are always easy and secure
... and without (sample) data file(s) working on problem isn't easy and secure
Happy HMG'ing
Viva INTERNATIONAL HMG
-
- Posts: 21
- Joined: Fri Aug 30, 2013 5:38 am
Re: EXIT BUTTON VALIDATION
I am attaching herewith prg & dbf file as per your need.
Beside this I want to say that in previous period in clipper application I always give validation question to question and Is is required because manytimes another question is depend on answer of previous question.
Beside this I want to say that in previous period in clipper application I always give validation question to question and Is is required because manytimes another question is depend on answer of previous question.
- Attachments
-
- TEST.ZIP
- (1.44 KiB) Downloaded 302 times
-
- Posts: 1275
- Joined: Tue Sep 03, 2013 4:22 am
- Location: Tecámac, México
Re: EXIT BUTTON VALIDATION
If ...
What I see is that if your program works ....
1. - When you give the code of the company, if there does not say anything and goes to the next textbox, if there is already alerts you that this code already exists.
Two. - When you give a company name and does not warn you if you leave anything blank, you say there is a BUG, that you can not leave empty the Textbox.
Three. - When you want to register, just this that option and give enter.
The problem I see is that you have no option to cancel if not correct. you back or if you want to change something.
I think you should implement "High", "Low", "Changes", and "Queries" on your screen.
Or is something else you need?
What I see is that if your program works ....
1. - When you give the code of the company, if there does not say anything and goes to the next textbox, if there is already alerts you that this code already exists.
Two. - When you give a company name and does not warn you if you leave anything blank, you say there is a BUG, that you can not leave empty the Textbox.
Three. - When you want to register, just this that option and give enter.
The problem I see is that you have no option to cancel if not correct. you back or if you want to change something.
I think you should implement "High", "Low", "Changes", and "Queries" on your screen.
Or is something else you need?
- esgici
- Posts: 4543
- Joined: Wed Jul 30, 2008 9:17 pm
- DBs Used: DBF
- Location: iskenderun / Turkiye
- Contact:
Re: EXIT BUTTON VALIDATION
Don't be lost yourself into labirent of questions built by yourselfmanoj_duamzn wrote:...another question is depend on answer of previous question.
Attached a suggestion, not a real manager; a simple sample only :
Doesn't provide bell and whistles; only works, does its job
I hope give you an idea
Happy HMG'ing
Viva INTERNATIONAL HMG
Re: EXIT BUTTON VALIDATION
Hello,manoj_duamzn wrote:I am attaching herewith prg & dbf file as per your need.
Beside this I want to say that in previous period in clipper application I always give validation question to question and Is is required because manytimes another question is depend on answer of previous question.
It seems that you think in clipper direction hitherto however your environment was changed now
BTW you can take a look for your updated sample with implemented your needs below:
Code: Select all
#include "minigui.ch"
#xtranslate VALID <condition> [MESSAGE <message>];
=>;
ON LOSTFOCUS _DOVALID (<condition>,<message>)
MEMVAR _HMG_ISVALIDINPROGRESS
PROCEDURE MAIN()
PUBLIC CDIR,_HMG_ISVALIDINPROGRESS := .F.,exit := .F.
SET MULTIPLE OFF WARNING
SET NAVIGATION EXTENDED
CDIR='\'+CURDIR()
SET DEFA TO &CDIR
USE COMPANY
DEFINE WINDOW WINMAIN AT 0,0;
WIDTH 500 HEIGHT 700 TITLE "TESTING SOFTWARE";
WINDOWTYPE MAIN
DEFINE MAIN MENU
POPUP "FIRM MENU"
ITEM "CREATE NEW FIRM" ACTION COMPADD()
ITEM "EDIT FIRM DATA" ACTION NIL
ITEM "SELECT A FIRM" ACTION NIL
ITEM "BACKUP FIRM DATA" ACTION NIL
ITEM "RESTORE FIRM DATA" ACTION NIL
ITEM "DELETE FIRM" ACTION NIL
SEPARATOR
ITEM "Exit" ACTION EXIT PROGRAM
END POPUP
END MENU
END WINDOW
MAXIMIZE WINDOW WINMAIN
WINMAIN.ACTIVATE()
RETURN
*****************
PROCEDURE COMPADD
*****************
exit := .F.
DEFINE WINDOW WINCOMPADD AT 100,100;
WIDTH 560 HEIGHT 360;
TITLE "Add New Company";
FONT 'ARIAL' SIZE 12;
WINDOWTYPE CHILD;
ON INIT WINCOMPADD.CC.SETFOCUS ;
ON INTERACTIVECLOSE exit:=.T.
@ 30, 30 LABEL LBLCC VALUE 'Company Code'
@ 80, 30 LABEL LBLCNAME VALUE 'Company Name'
@ 130,30 LABEL LBLCADD1 VALUE 'Address'
@ 230,30 LABEL LBLFDATE VALUE 'From Date'
@ 230,300 LABEL LBLTDATE VALUE 'To Date'
@ 30, 150 TEXTBOX CC WIDTH 25 MAXLENGTH 2 VALID V_CC() MESSAGE 'THIS COMPANY CODE ALREADY EXISTS....'
@ 80, 150 TEXTBOX CNAME WIDTH 375 MAXLENGTH 35 VALID V_CNAME()
@ 130,150 TEXTBOX CADD1 WIDTH 375 MAXLENGTH 80
@ 155,150 TEXTBOX CADD2 WIDTH 375 MAXLENGTH 80
@ 180,150 TEXTBOX CADD3 WIDTH 375 MAXLENGTH 80
@ 230,150 DATEPICKER FDATE
@ 230,380 DATEPICKER TDATE
@ 280,175 BUTTON BTNSAVE CAPTION 'Save' WIDTH 100 ON CLICK SAVECOMPANYDATA()
@ 280,285 BUTTON BTNEXIT CAPTION 'Exit' WIDTH 100 ACTION EXITWINDOW()
END WINDOW
WINCOMPADD.CENTER()
WINCOMPADD.ACTIVATE()
RETURN
*************
FUNCTION V_CC
*************
IF ! EMPTY(THIS.VALUE)
SELECT COMPANY
LOCA FOR COMPCODE=WINCOMPADD.CC.VALUE
IF FOUND()
RETURN .F.
ENDIF
ENDIF
RETURN .T.
****************
FUNCTION V_CNAME
****************
IF EMPTY(WINCOMPADD.CNAME.VALUE)
RETURN .F.
ENDIF
RETURN .T.
************************
FUNCTION SAVECOMPANYDATA
************************
IF ! EMPTY(WINCOMPADD.CC.VALUE)
SELECT COMPANY
APPE BLAN
REPL COMPCODE WITH WINCOMPADD.CC.Value
REPL COMPNAME WITH WINCOMPADD.CNAME.VALUE
REPL COMPADD1 WITH WINCOMPADD.CADD1.VALUE
REPL COMPADD2 WITH WINCOMPADD.CADD2.VALUE
REPL COMPADD3 WITH WINCOMPADD.CADD3.VALUE
REPL FROMDATE WITH WINCOMPADD.FDATE.VALUE
REPL TODATE WITH WINCOMPADD.TDATE.VALUE
MSGINFO("COMPANY HAS BEEN INSTALLED")
RELEASE WINDOW WINCOMPADD
ELSE
MSGSTOP("PLEASE ENTER COMPANY CODE!")
SETFOCUS CC OF WINCOMPADD
ENDIF
RETURN NIL
*******************
FUNCTION EXITWINDOW
*******************
RELEASE WINDOW WINCOMPADD
RETURN .T.
**************************************
FUNCTION _DOVALID (EXPRESSION,MESSAGE)
**************************************
IF _HMG_ISVALIDINPROGRESS .OR. THIS.FOCUSEDCONTROL == "BTNEXIT" .OR. exit
RETURN NIL
ELSE
IF VALTYPE(MESSAGE)="U"
MESSAGE := "INVALID ENTRY"
ENDIF
_HMG_ISVALIDINPROGRESS := .T.
IF (EXPRESSION,NIL,(MSGSTOP(MESSAGE,"ERROR"),THIS.SETFOCUS))
_HMG_ISVALIDINPROGRESS := .F.
ENDIF
RETURN NIL
Hope that helps
Kind Regards,
Grigory Filatov
"Everything should be made as simple as possible, but no simpler." Albert Einstein
Grigory Filatov
"Everything should be made as simple as possible, but no simpler." Albert Einstein