- This topic has 16 replies, 3 voices, and was last updated 8 years, 5 months ago by Support.
-
AuthorPosts
-
May 18, 2016 at 1:21 pm #36972HeDiBoParticipant
This picture shows three stages of clicking a date in the next month (clicking June 4 in the May calendar):
[attachment=7705:CalendarBug.jpg]
The blue circle shows where the cursor is during this.
The cursor rests on June 4 in picture 1.
Clicking June 4 results in picture 2: the highlight is on June 4 but the cursor is now on July 9 (because it didn't move to the new highlight).
Releasing the button results in picture 3: the highlight has moved to July 9.
So if you click on a day that will change the month, things go haywire.
Second problem: neither OnMouseUp nor OnMouseDown are fired :a1:
May 20, 2016 at 10:47 am #55014HeDiBoParticipantWhen OnMouseUp and OnMouseDown work, there should be an easy way to get from the X,Y coordinates to the pertinent date.
May 20, 2016 at 8:27 pm #55016Ronaldo SouzaParticipant'HeDiBo' wrote:When OnMouseUp and OnMouseDown work, there should be an easy way to get from the X,Y coordinates to the pertinent date.
I believe you can use the day, month & year fieds to get the current date:
procedure TForm1.sMonthCalendar1Change(Sender: TObject); //OnChange handler
begin
Form1.Caption := Format('%0.2d/%0.2d/%0.2d',[sMonthCalendar1.day,sMonthCalendar1.month,sMonthCalendar1.year]);
end;
Hope it helps!
Best regards,
Ronaldo
May 22, 2016 at 10:04 am #55018HeDiBoParticipant'Ronaldo wrote:I believe you can use the day, month & year fieds to get the current date:
Thank you for your efforts. Much appreciated.
In the OnMouseUp and OnMouseDown event the X and Y coordinates in the parameters do not reflect the current date. Clicking on a date with the right mouse button means the current day, month and year properties are not updated to the mouse position so only X and Y are the values usable. Therefore there should be an easy way to get from (X,Y) to the date clicked.
May 23, 2016 at 7:06 am #55022SupportKeymasterHi!
I see this problem and I will solve it in the nearest release, thanks for the messages.
May 31, 2016 at 4:22 pm #55080HeDiBoParticipant'Support' wrote:Hi!
I see this problem and I will solve it in the nearest release, thanks for the messages.
I am very sorry to finding out that you corrected this bug in the beta release 11 but not in the stable release 10.
June 1, 2016 at 7:19 am #55083SupportKeymasterI have added changes into the v10 also. I hope to release the v10.30 soon.
June 1, 2016 at 5:50 pm #55098HeDiBoParticipant'Support' wrote:I have added changes into the v10 also. I hope to release the v10.30 soon.
Great, thanks :a3:
Will that also include function(s) to get from the X and Y coordinates of OnMouseUp and OnMouseDown to cell coordinates and then to date?
I want to implement a right click event in a calendar, much like the OnDblClick event.
June 3, 2016 at 8:52 am #55106SupportKeymasterOk, the MousePosToDate function will be added )
June 3, 2016 at 5:48 pm #55116HeDiBoParticipant'Support' wrote:Ok, the MousePosToDate function will be added )
Maybe it should be done in two functions:
MouseToCell from the underlying TsCalendarGrid is already there. All we need therefore is CellToDate. For that all you have to do is make the private function GetCellDate part of a new property “CellDate” (a read-only property). That was probably your plan from the beginning, considering the analog CellText property.
June 7, 2016 at 11:58 am #55124SupportKeymasterHi!
The protected GetCellDate function exists there, I can move it to the “public”:
Code:function GetCellDate(ACol, ARow: Integer): TDateTime;June 7, 2016 at 5:58 pm #55131HeDiBoParticipant'Support' wrote:Hi!
The protected GetCellDate function exists there, I can move it to the “public”:
Code:function GetCellDate(ACol, ARow: Integer): TDateTime;You already have this public property:
Code:property CellText[ACol, ARow: Integer]: string read GetCellText;So, analogous, you could add this:
Code:property CellDate[ACol, ARow: Integer]: TDateTime read GetCellDate;Looks even better, don't you think?
June 9, 2016 at 9:22 am #55140SupportKeymasterYes, you are right, CellDate will be added.
June 9, 2016 at 6:07 pm #55154HeDiBoParticipant'Support' wrote:Yes, you are right, CellDate will be added.
I edited my post, because it returned a String i.s.o. a TDateTime
June 11, 2016 at 10:13 am #55163HeDiBoParticipantFunction MousePosToDate works like a charm :a3:.
The property CellDate should produce the same result. But because the caller does not know about the grid's borders, it is a week off. I think it could be removed again, because it serves no purpose this way.
See what I mean in this project: [attachment=7739:acCalendarMouseUp.zip]
June 11, 2016 at 3:00 pm #55166HeDiBoParticipantTo my dismay, now DoubleClick doesn't work anymore 😡
If OnMouseUp is defined, it does not fire (which is standard behavior), but…
if OnMouseUp is undefined, it fires TWO TIMES!
The problem is in this definition:
Code:TsCalendGrid = class(TDrawGrid)
private
FOwner: TsMonthCalendar;
procedure WMSize (var Message: TWMSize ); message WM_SIZE;
procedure WMMouseActivate(var Message: TMessage); message WM_MOUSEACTIVATE;
protected
procedure WndProc(var Message: TMessage); override;
procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override;
procedure MouseUp (Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override;
procedure DblClick; override; // This should be removed again: double click already works on the owning TsMonthCalendar
publicJune 13, 2016 at 9:16 am #55169SupportKeymasterUpdated sMonthCalendar is available there:
http://www.alphaskins.com/forum/index.php?app=core&module=attach§ion=attach&attach_id=7741
-
AuthorPosts
- You must be logged in to reply to this topic.