Autor Beitrag
Flash106
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 234


D7 Ent
BeitragVerfasst: So 21.08.05 21:28 
Hallo,

ich will einfach wie bei allen Grid mit der Methode MouseCoord die Mauskoordinaten in GridCoords umrechnen. Es handelt sich allerdings um die Calender Kompo die kein MouseMove oder ähnliches hat. Ist auch nicht wichtig da ich es im OnClick benötige. Es funzt aber nicht. Bekomme nur -1 für beide werte zurück. Also für Row und Col. Hier mal der Source:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
...

var
  Form1: TForm1;
  pCoord : TGridCoord;

procedure TForm1.CalendarClick(Sender: TObject);
begin
  pCoord := Calendar.MouseCoord(Mouse.CursorPos.X,Mouse.CursorPos.Y);
  label2.Caption := 'Col: ' + IntToStr(pCoord.x) + ' ' + 'Row: ' + IntToStr(pCoord.y);
end;

...


Was stimmt denn nicht?!??!

PS: In Mouse.CursorPos.X und Y stehen richtige Werte. Habe ich schon getestet...
Lannes
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2352
Erhaltene Danke: 4

Win XP, 95, 3.11, IE6
D3 Prof, D4 Standard, D2005 PE, TurboDelphi, Lazarus, D2010
BeitragVerfasst: So 21.08.05 22:03 
Hallo,

ScreenToClient sollte Dir weiterhelfen,
ein Beispiel (D3 kennt Mouse.CursorPos nicht):
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
var pCoord : TGridCoord;
    CurPos : TPoint;
begin
  GetCursorPos(CurPos);
  CurPos := Calendar1.ScreenToClient(p);
  pCoord := Calendar1.MouseCoord(CurPos.X,CurPos.Y);
  showmessage('Col: ' + IntToStr(pCoord.x) + ' ' + 'Row: ' + IntToStr(pCoord.y));

_________________
MfG Lannes
(Nichts ist nicht Nichts) and ('' <> nil ) and (Pointer('') = nil ) and (@('') <> nil )
Flash106 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 234


D7 Ent
BeitragVerfasst: Di 23.08.05 10:03 
FUNZT!! DAAAAAAANKE *hüpf*