This post should be removed, the following post is identical, the only difference is, that bbcode is ok.
Hi friends,
still playing around with dates, once again I found a strange behaviour (at least in my opinion) of the compiler: I use IDE "RUN" to compile. It has to do with the semicolon, telling the compiler, that the following line is not a new line, but the previous one is continued.
How do I know, if a new line in source code is requested? Please see attached source code.
[code)#include "hmg.ch"
FUNCTION Main()
local cDat, cDatum
cName:=GetComputerName()
set language to german
set century on
set date to german
set date format to "DD.MM.YYYY"
set navigation extended
//MsgInfo('Computer-Name: '+ cName)
*************
DEFINE WINDOW Date_1 ;
AT 120,120 ;
WIDTH 600 ;
HEIGHT 400 ;
FONT 'ARIAL' Size 14 ;
TITLE "Wochentag eines Datums" ;
MAIN
END WINDOW
On Key F10 of date_1 action showdat()
//Why no semicolons necessary in the followin labels?
****************************************************************
DEFINE LABEL datum_0
PARENT Date_1
ROW 40
COL 10
width 300
height 50
FONTNAME 'ARIAL'
FONTSIZE 12
autosize .T.
VALUE "Find out the CDOW() of a date"
END LABEL
DEFINE LABEL datum
PARENT Date_1
ROW 150
COL 10
width 300
height 50
FONTNAME 'ARIAL'
FONTSIZE 12
autosize .T.
VALUE "Enter date,go on with RETURN or F-10"
END LABEL
@ 200,10 TEXTBOX date ;
PARENT Date_1 ;
WIDTH 120 ;
HEIGHT 30 ;
Font 'ARIAL' SIZE 14 ;
value nil ;
date ;
On Enter showdat()
DEFINE BUTTON showdat
PARENT date_1
ROW 200
COL 140
CAPTION 'F-10'
ONCLICK showdat()
Fontname 'ARIAL'
FontSize 14
WIDTH 60
HEIGHT 30
END BUTTON
ACTIVATE WINDOW Date_1
RETURN NIL
*****************************************************
//CDOW() is shown in German.
function showdat
cDat:=dtos(Date_1.date.value)
cDatum:=dtoc(Date_1.date.value)
if empty(cDat)
MsgInfo('No valid date')
else
// MsgInfo(cDat)
// MsgInfo(cDatum)
MsgInfo(cDatum+' = '+cdow(Date_1.date.value))
endif
Date_1.release
return [/code]
Maybe someone can explain that to me (retiring in 2 weeks) but working on with hmg to keep my brains alive.
Robert