Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site











SourceForge.net Logo

Days

 

Displays a number of days between two dates

 

 

 

Days.h

 

#ifndef _Days_Days_h

#define _Days_Days_h

 

#include <CtrlLib/CtrlLib.h>

 

using namespace Upp;

 

#define LAYOUTFILE <Days/Days.lay>

#include <CtrlCore/lay.h>

 

class Days : public WithDaysLayout<TopWindow> {

public:

    typedef Days CLASSNAME;

    Days();

};

 

#endif

 

 

 

main.cpp

 

#include "Days.h"

 

Days::Days()

{

    CtrlLayout(*this, "Days");

    date1 ^= date2 ^= [=] {

        result = IsNull(date1) || IsNull(date2) ? "" :

                 Format("There is %d day(s) between %` and %`", abs(Date(~date1) - Date(~date2)), ~date1, ~date2);

    };

}

 

GUI_APP_MAIN

{

    Days().Run();

}

 

 

 

Days.lay

 

LAYOUT(DaysLayout, 320, 64)

    ITEM(EditDate, date1, LeftPosZ(52, 100).TopPosZ(8, 19))

    ITEM(Label, dv___1, SetLabel(t_("Date 1")).LeftPosZ(8, 40).TopPosZ(8, 19))

    ITEM(EditDate, date2, LeftPosZ(212, 100).TopPosZ(8, 19))

    ITEM(Label, dv___3, SetLabel(t_("Date 2")).LeftPosZ(168, 40).TopPosZ(8, 19))

    ITEM(Label, result, LeftPosZ(8, 304).TopPosZ(36, 19))

END_LAYOUT

 

 

 

 

 

Do you want to contribute?