Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 339754 - DateTime doesn't mark current date with SWT.CALENDAR style
Summary: DateTime doesn't mark current date with SWT.CALENDAR style
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 4.1   Edit
Hardware: All Linux-GTK
: P3 normal (vote)
Target Milestone: 4.4 M5   Edit
Assignee: Sravan Kumar Lakkimsetti CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-11 14:33 EST by Arun Thondapu CLA
Modified: 2014-01-17 08:26 EST (History)
1 user (show)

See Also:


Attachments
Proposed Patch (1.19 KB, patch)
2014-01-14 04:52 EST, Sravan Kumar Lakkimsetti CLA
no flags Details | Diff
Revised Patch (1.40 KB, patch)
2014-01-16 02:09 EST, Sravan Kumar Lakkimsetti CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Arun Thondapu CLA 2011-03-11 14:33:52 EST
Build Identifier: 

DateTime needs to use gtk_calendar_mark_day() to mark the current date when the style is set to SWT.CALENDAR too. Currently, this is only done in the drop down calendar that pops up with SWT.DATE style.
Please refer to Bug #329291 for more details.

Reproducible: Always
Comment 1 Arun Thondapu CLA 2014-01-03 02:14:59 EST
Sravan, can you please provide a patch for this? Thanks!
Comment 2 Sravan Kumar Lakkimsetti CLA 2014-01-14 00:54:11 EST
The approach I am looking is set the gtk_calendar_mark_day() when the calendar is showing the current month and year. otherwise remove the highlighting marks on the calendar using gtk_calendar_clear_marks

This will highlight the todays date.
Comment 3 Sravan Kumar Lakkimsetti CLA 2014-01-14 04:52:44 EST
Created attachment 238955 [details]
Proposed Patch

Here is the proposed patch for Bug339754. I am unable to submit the patch to gerrit. Due to this I am attaching the patch here

Thanks
Sravan
Comment 4 Sravan Kumar Lakkimsetti CLA 2014-01-14 08:33:30 EST
Arun,

Can you please review the patch attached?

Thanks
Sravan
Comment 5 Sravan Kumar Lakkimsetti CLA 2014-01-16 02:09:41 EST
Created attachment 239049 [details]
Revised Patch

revised patch to include fix for highlighting the current date(today) when we move
to current month using arrow keys.
For example if the current month is jan 2014 and using arrow keys move to different month and comeback to jan 2014 the current date is not getting highlighted. This patch fixes the problem.

Description of the fix
The highlighting of current date is taken care by the calendar sendselectionevent method. In the mouse movement for the popupCalendar there is a call to clear all the marks, this is causing the problem. Since the highlighting is handled by the Calendar object already this is not required anymore
Comment 6 Arun Thondapu CLA 2014-01-17 05:54:51 EST
(In reply to Sravan Kumar Lakkimsetti from comment #5)
> Created attachment 239049 [details]
> Revised Patch
> 
> revised patch to include fix for highlighting the current date(today) when
> we move
> to current month using arrow keys.
> For example if the current month is jan 2014 and using arrow keys move to
> different month and comeback to jan 2014 the current date is not getting
> highlighted. This patch fixes the problem.

Thanks for the patch Sravan! I have tested it and it seems to be working fine for me but there are a couple of changes to be made.

1) The current date is not highlighted when the calendar becomes visible for the first time after creation, it seems to work only after some date change event is processed. (tested with ControlExample and Snippet250).

2) Please change the if ... else code block to follow SWT coding style as follows:

if (something) {
    // do something
} else {
   // do something else
}
Comment 7 Sravan Kumar Lakkimsetti CLA 2014-01-17 08:26:41 EST
Fixed this bug with the following commit

https://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=6c621148e4f8d62b288aaf2751c64105309afd20