Re: 7GUIs

new topic     » goto parent     » topic index » view thread      » older message » newer message
irv said...

Can someone suggest a better way of validating input dates?

It's not too bad - the only one thing I might say is move the >=0 to inside ValidDateRange(). Here's what I did, using my own (decidedly Phix-only) timedate.e library:

include builtins\timedate.e 
set_timedate_formats({"DD.MM.YYYY"}) -- (add more if rqd) 
 
sequence d1 = parse_date_string(IupGetAttribute(T1,"VALUE")), 
         d2 = parse_date_string(IupGetAttribute(T2,"VALUE")) 
bool b1ok = timedate(d1), 
     b2ok = item=1 or (timedate(d2) and d2>=d1) 
    IupSetAttribute(T1,"BGCOLOR",iff(b1ok?"TXTBGCOLOR":"255 0 0")) 
    IupSetAttribute(T2,"BGCOLOR",iff(b2ok?"TXTBGCOLOR":"255 0 0")) 
    IupSetInt(T2,"ACTIVE",item=2) 
    IupSetInt(B,"ACTIVE",b1ok and b2ok) 

Just about got the Cells task working, now that was fun (some more cleanup/testing rqd).

Pete

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu