Hi Serge,
thx for your reply,
I have a Main.prg with function main and a main window win_1 and a second window win_2 (not main).
To keep the app more readable I decided to define any further window in separate prg-files outside the main.prg.
But I get this syntax-error, though the only change of the code in my initial post is, that I removed the semicolon and the main-statement.
I set windowtype to child. Do I have to set another windowtype?
When I come home from work I will send the source code.
Robert
Check for valid
Moderator: Rathinagiri
Re: Check for valid
Remember about #include <hmg.ch> in all .prg
Main.prg
Form1.prg
Main.prg
Code: Select all
#include <hmg.ch>
Function Main
DEFINE WINDOW Main ;
AT 90,90 ;
WIDTH 400 ;
HEIGHT 250 ;
TITLE "MAIN" ;
MAIN
@10,10 BUTTON b_1 CAPTION "Form_1" ACTION form_1()
END WINDOW
ACTIVATE WINDOW Main
RETURN NIL
Code: Select all
#include <hmg.ch>
Function form_1
local cMon, cYear
IF IsWindowDefined(Form_1)
DoMethod ('Form_1' , 'SetFocus')
RETURN Nil
ENDIF
set navigation extended
DEFINE WINDOW Form_1 ;
AT 90,500 ;
WIDTH 400 ;
HEIGHT 250 ;
TITLE "Year/Month"
@ 20,20 LABEL lbl1 ;
PARENT Form_1 ;
VALUE "Monat 2-stellig" //month 2 digits
@ 20,150 LABEL lbl2 ;
PARENT Form_1 ;
VALUE "Jahr 4-stellig" //year 4 digits
@ 40,20 TEXTBOX Text_1 ;
parent Form_1;
value cMon;
inputmask "99" On LostFocus chkmon() On Enter chkmon()
@ 40,150 TEXTBOX Text_2;
PARENT Form_1;
value cYear;
inputmask "9999" On LostFocus chkYear() On Enter chkyear()
@ 150,20 LABEL lbl3 value 'Ende mit F-10';
FONTCOLOR BLUE
on key F10 action fill_MonYear()
END WINDOW
ACTIVATE WINDOW Form_1
close databases
RETURN NIL
function fill_MonYear
SetProperty('Form_1','text_1','Value',GetProperty('Form_1','Text_1','Value'))
cMon:=GetProperty('Form_1','Text_1','Value')
SetProperty('Form_1','text_2','Value',GetProperty('Form_1','Text_2','Value'))
cYear:=GetProperty('Form_1','Text_2','Value')
pend()
return
function pend
MsgInfo( cMon+'/'+cYear)
release Window Form_1
return
function chkmon
use mon // this table contains all valid values for cMon
index on mon to mon
seek Form_1.Text_1.value
if !found()
MsgInfo('Only 01 - 12 allowed')
//Form_1.Text_1.value:=" "
Form_1.Text_1.SetFocus
endif
return
function chkyear
if val(Form_1.Text_2.value)>year(date())
MsgInfo('Only current or former years allowed')
//Form_1.Text_2.Value:=" "
Form_1.Text_2.SetFocus
endif
return
Re: Check for valid
I'm not sure,but maybe I have really not included hmg.ch.
I will see,when I come home from work.
Thank you.
I will see,when I come home from work.
Thank you.
Re: Check for valid
Shame on me
I have to apologize, indeed I had forgotten to include hmg.ch.
Now evrything is ok.
The 'syntax error'-message was misleading me, brought me on the wrong track.
Thank you for your changes of my code.
Robert
I have to apologize, indeed I had forgotten to include hmg.ch.
Now evrything is ok.
The 'syntax error'-message was misleading me, brought me on the wrong track.
Thank you for your changes of my code.
Robert