English
Source / code snippets

Dateedit date allocate

 

Jac
de
Lad
Ähm, how can I one DateEdit one new date allocate??? has someone ne idea?

Jac
 
Profan² 2.6 bis XProfan 11.1+XPSE+XPIA+XPRR (und irgendwann XIDE)
Core2Duo E8500/T2250, 8192/1024 MB, Radeon HD4850/Radeon XPress 1250, Vista64/XP
06/06/06  
 



there's here a integrally hervorragende Class of Roland: [...] 
CompileMarkSeparation
DEF DToN(1)  !"PRFDAT32.DLL","DToN"
DEF NToD(1)  !"PRFDAT32.DLL","NToD"
DEF DOW(1)   !"PRFDAT32.DLL","DOW"
class Date =  #Date$(32),
#Year%,
#Month%,
#Day%,
#DayOfWeek%,
-DateDLL&,
-DateEdit&,
-DateInt&,
-Form$(30),
Init@,
GetDate@,
GetYear@,
GetMonth@,
GetDay@,
GetDayOfWeek@,
SetDate@,
SetFormat@,
SetYear@,
SetMonth@,
SetDay@,
AddDays@,
DiffDays@,
CreateEdit@,
KillEdit@,
-konvD@,
-SetDateEdit@

PROC Date.setDateEdit

    declare daten#

    If .DateEdit& > 0

        dim daten#,20
        SendMessage(.DateEdit&,4097,0,daten#)
        Word Daten#,0=.Year%
        Word Daten#,2=.Month%
        Word Daten#,6=.Day%
        SendMessage(.DateEdit&,4098,0,daten#)

    EndIf

    dispose daten#

ENDPROC

PROC Date.konvD

    parameters d$

    If .DateDLL& > 31

        .DateInt& = DToN(Val(d$))

    Else

        .DateInt& = 0

    EndIf

    .Year% = Val(Mid$(d$,1,4))
    .Month% = Val(Mid$(d$,5,2))
    .Day% = Val(Mid$(d$,7,2))
    .setDateEdit()

Endif

ENDPROC

PROC Date.Init

declare d$
d$ = Date$(3)
.DateDLL& = UseDll("PRFDAT32.DLL")
.Date$ = Date$(0)
.konvD(d$)
.Form$ = "dd.mm.yyyy"

ENDPROC

PROC Date.setDate

declare OK%
OK% = 1

if %pcount = 1

    parameters in$
    declare d$, err%
    err% = set("ErrorLevel",-1)
    d$ = CToD$(in$)

    if %error

        .Date$ = ""
        .Year% = 0
        .Month% = 0
        .Day% = 0
        OK% = 0  Fehler

    else

        .Date$ = ins$
        .konvD(d$)

    endif

    set("ErrorLevel",err%)

elseif %pcount = 3

    parameters y%,m%,d%

    if (y% >= 1600) and (y% < 4000)

        .Year% = y%

    else

        OK% = 0

    endif

    if (m% > 0) and (m% < 13)

        .Month% = m%

    else

        OK% = 0

    endif

    if (d% > 0) and (d% < 32)

        .Day% = d%

    else

        OK% = 0

    endif

    if Ok%

        .Date$ = format$("00",d%) + "." + format$("00",m%) + format$("0000",y%)

    endif

else

    OK% = 0

endif

return OK%

ENDPROC

PROC Date.getDate

if %pcount > 0

    parameters f$

else

    declare f$
    f$ = trim$(.Form$)

endif

f$ = translate$(f$,"yyyy",Str$(.Year%))
f$ = translate$(f$,"yy",Format$("00",Str$(.Year% MOD 100)))
f$ = translate$(f$,"mm",Format$("00",Str$(.Month%)))
f$ = translate$(f$,"m",Str$(.Month%))
f$ = translate$(f$,"dd",Format$("00",Str$(.Day%)))
f$ = translate$(f$,"d",Str$(.Day%))
return f$

ENDPROC

PROC Date.setYear

parameters y%

if (y% >= 1600) and (y% < 4000)

    .Year% = y%
    .Date$ = format$("00",.Day%) + "." + format$("00",.Month%) + format$("0000",.Year%)
    return 1

else

    return 0

endif

ENDPROC

PROC Date.setMonth

parameters m%

if (m% > 0) and (m% < 13)

    .Month% = m%
    .Date$ = format$("00",.Day%) + "." + format$("00",.Month%) + format$("0000",.Year%)
    return 1

else

    return 0

endif

ENDPROC

PROC Date.setDay

parameters d%

if (d% > 0) and (d% < 32)

    .Day% = d%
    .Date$ = format$("00",.Day%) + "." + format$("00",.Month%) + format$("0000",.Year%)
    return 1

else

    return 0

endif

ENDPROC

PROC Date.setFormat

parameters f$
.Form$ = f$

ENDPROC

PROC Date.getYear

return .Year%

ENDPROC

PROC Date.getMonth

return .Month%

ENDPROC

PROC Date.getDay

return .Day%

ENDPROC

PROC Date.getDayOfWeek

declare n&

if .DateDLL& > 32

    n& = DTON(val(.getDate("yyyymmdd")))
    return DOW(n&)

else

    return 0

endif

ENDPROC

PROC Date.AddDays

parameters days%
declare d&, n&

if .DateDLL& > 32

    d& = val(.getDate("yyyymmdd"))
    n& = DTON(d&) + days%
    d& = NTOD(n&)
    .setDay(d& mod 100)
    .setMonth((d&  100) mod 100)
    .setYear(d&  10000)
    .setDate(.Year%,.Month%,.Day%)
    return 1

else

    return 0

endif

ENDPROC

PROC Date.DiffDays

parameters d2#
declare n2&,n1&

if .DateDLL& > 32

    n1& = DTON(val(.getDate("yyyymmdd")))
    n2& = DTON(val(d2#.getDate("yyyymmdd")))
    return int(n2& - n1&)

else

    return 0

endif

ENDPROC

PROC Date.createEdit

parameters hdlg&, x&, y&, dx&, dy&
.DateEdit& = Create("DateEdit", hdlg&, "", x&, y&, dx&, dy&)
.setDateEdit()
return .DateEdit&

ENDPROC

PROC Date.killEdit

return DestroyWindow(.DateEdit&)

ENDPROC

 
06/06/06  
 




Jac
de
Lad
Ahh, thanks, there's certainly the thereby, I Search!

Jac
 
Profan² 2.6 bis XProfan 11.1+XPSE+XPIA+XPRR (und irgendwann XIDE)
Core2Duo E8500/T2250, 8192/1024 MB, Radeon HD4850/Radeon XPress 1250, Vista64/XP
06/06/06  
 



Zum Quelltext


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

6.798 Views

Untitledvor 0 min.
Manfred Barei06/09/22
PETER195607/18/18
rquindt03/17/18
p.specht02/08/17
More...

Themeninformationen

this Topic has 2 subscriber:

Jac de Lad (2x)
iF (1x)


Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie