modify the program siutably so that once the calender for a particular year has been displayed on screen , and year has been displayed on the screen,then using arrow keys the user must be able to change the calender in the following manner:
UP ARROW KEY :next year,same month
DOWN ARROW KEY: previous year,same month
RIGHT ARROW KEY: same year,next month
LEFT ARROW KEY: same year,previous month

Recommended Answers

All 4 Replies

Ok, so where's your code ?

You can use this way:

#define ESC 0xXX //Key Code for escape
#define UPARROW 0xXX //Key Code for up arrow
#define DOWNARROW 0xXX //Key Code down arrow
#define RIGTHARROW 0xXX //Key Code for right arrow
#define LEFTARROW 0xXXX //Key Code for left arrow

while(key = getKey() !=  ESC) {
     if(key == UPARROW) {
            //Here put the validation of year for not more than MAX limit
            year++;
     }
     if(key == DOWNARROW) {
             //Here put the validation of year for not less than 0
            year--;
     }
      if(key == RIGHTARROW) {
            
            month++;
            if(month>11) {
                  year++;  
                  month = 0;
           } 
     }
      if(key == LEFTARROW) {
            month--;
            if(month<0) {
                year--;
                month=0;
           }
     }

     drawCalander(year,month);

}

Its a general way you can modify it as per ur requirments.

modify the program siutably so that once the calender for a particular year has been displayed on screen , and year has been displayed on the screen,then using arrow keys the user must be able to change the calender in the following manner:

Modify which program?

hahaha here we go a homewok thread again. SivaKrishana show us a snap or some of your code, that way you might get some more help. Luckychap had shown some code, which is some thing very important for your application. Have a look at it.

ssharish

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.