Autor Beitrag
Roy
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 184

Windows7 Ultimate
Delphi 2007, NET, Embarcadero
BeitragVerfasst: Mo 08.01.07 20:57 
Hallo und Guten Abend.

Ich möchte durch ein OnMouseMove mir einen Text im Label anzeigen lassen. Wie kann ich das OnMouseMove selbstständig beenden?


Moderiert von user profile iconGausi: Topic aus Multimedia / Grafik verschoben am Di 09.01.2007 um 10:01
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Mo 08.01.07 21:07 
Moin!

Im Ereignishandler:
ausblenden Delphi-Quelltext
1:
<deine Komponente>.OnMouseMove := NIL;					

;)

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
Roy Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 184

Windows7 Ultimate
Delphi 2007, NET, Embarcadero
BeitragVerfasst: Mo 08.01.07 22:08 
für mich bitte nochmal Klartext!

Ich gehe mit dem Cursor auf ein Bild und durch das Image5MouseMove lasse ich mir im Label einen Text anzeigen.

In welcher Komponente soll ich welchen Ereignishandler auf

<deine Komponente>.OnMouseMove := NIL;

setzen???
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Mo 08.01.07 22:25 
Moin!

user profile iconRoy hat folgendes geschrieben:
Ich gehe mit dem Cursor auf ein Bild und durch das Image5MouseMove lasse ich mir im Label einen Text anzeigen.

<deine Komponente>.OnMouseMove := NIL;

:arrow: Image5.OnMouseMove := NIL; ;)

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
Roy Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 184

Windows7 Ultimate
Delphi 2007, NET, Embarcadero
BeitragVerfasst: Mo 08.01.07 23:44 
funktioniert leider nicht
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Mo 08.01.07 23:49 
Moin!

user profile iconRoy hat folgendes geschrieben:
funktioniert leider nicht

Meinst du, du schaffst auch noch etwas mehr als 3 Worte? :roll:

Was genau willst du denn eigentlich, mach doch einfach mal ein Beispiel? ;)

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Mo 08.01.07 23:51 
Naja, was der Code macht, ist ja, den EventHandler zu deaktivieren, sobald dieser Code ausgeführt wird.
Was willst du denn sonst machen?

Und was funktioniert denn nicht? Was hast du gemacht, was hast du erwartet und was ist wirklich passiert?
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Mo 08.01.07 23:52 
Moin!

Gibt´s hier ein Echo? :D :zwinker:

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Di 09.01.07 00:01 
Ich sollte nicht so viel parallel machen... 3x ICQ, Teamspeak Gespräch am Laufen, Programmieren, Fernsehen (Briefmarkengröße von der TV-Karte recht unten im Bildschirm ;-))...
Da brauch ich immer so lange für die Antwort, dass schon jemand anderes geantwortet hat, weil ich den Browser dabei kurz mal minimiere, etc. :lol:
Roy Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 184

Windows7 Ultimate
Delphi 2007, NET, Embarcadero
BeitragVerfasst: Di 09.01.07 09:50 
Moin,
entschuldigt meine wenigen Worte, werde mich bessern!

Darf ich jemandem meine Sourcen anvertrauen und der schaut sich das mal an?

Roy
freedy
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 403
Erhaltene Danke: 1

Winows 7
Delphi XE
BeitragVerfasst: Di 09.01.07 09:55 
Hi!

Es sollte kein Problem sein, den wichtigen Code hier zu posten. Ausserdem wollen wir dir helfen und nicht spionieren. ;-)

Gruß
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8554
Erhaltene Danke: 481

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Di 09.01.07 10:00 
Nein, du solltest deine Frage hier im Forum näher erläutern, dann haben alle was davon. ;-)

Ich vermute, dass du bisher missverstanden wurdest und versuche mal was anderes: Du möchtest, dass etwas passiert, wenn man die Maus irgendwo bewegt (Anzeige eines Textes). Ich nehme an, dass du möchtest, dass dieser Text wieder verschwindet, wenn man die Maus dort nicht mehr bewegt, oder die Maus den passenden Bereich verlässt, richtig?

Das geht nicht so ohne weiteres mit OnMouseMove, da das nur ausgelöst wird, wenn sich die Maus bewegt. Du könntest in den OnMouseMove-Events der anderen Komponenten das Löschen des Textes veranlassen. Oder, du verwendest MouseEnter/MouseLeave, was aber bei älteren Delphi-Versionen nicht überall dabei ist (ich meine vor kurzem hier gelesen zu haben, dass das bei Delphi2006 geht).
Eine komplett andere Möglichkeit wäre die Eigenschaft Hint (mit ShowHint auf True). Das sind diese kleinen gelben Hinweistexte, die bei einigen Anwendungen aufpoppen, wenn man auf ein Element zeigt.

_________________
We are, we were and will not be.
Roy Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 184

Windows7 Ultimate
Delphi 2007, NET, Embarcadero
BeitragVerfasst: Di 09.01.07 10:36 
Also der Teilcode schaut so aus....

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
procedure TForm1.Image5MouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
begin
 Label2.Caption:= 'Rechnungen drucken';

end;



ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
procedure TForm1.Label2MouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
begin
 Image5.OnMouseMove := NIL;
end;



Moderiert von user profile iconjasocul: Delphi-Tags hinzugefügt
freedy
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 403
Erhaltene Danke: 1

Winows 7
Delphi XE
BeitragVerfasst: Di 09.01.07 11:16 
*räusper* geht das auch in Delphi-Formatierung? ;-)

Du möchtest also einfach einen Hover-Effekt? Setz dir eine Variable z.B. FMouseOver. In OnMouseMove prüfst du dann, ob sich die Mouse über dem Bild befindet. *grübel* Oder ist das immer der Fall? --- Bin mir gerade nicht sicher. Ansonsten einfach die Komponente ableiten und entsprechende Windows Message abfangen z.B. so:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
  procedure CMMouseEnter(var Message: TMessage); message CM_MOUSEENTER;
  procedure CMMouseLeave(var Message: TMessage); message CM_MOUSELEAVE;

// im Implementations-Teil

  procedure TMyImage.CMMouseEnter(var Message: TMessage);
  begin
    if (csDesigning in ComponentState) then
      Exit;

    FMouseOver := true;

    // hier evtl. ein Ereignis erzeugen
  end;

  procedure TMyImage.CMMouseLeave(var Message: TMessage);
  begin
    if (csDesigning in ComponentState) then
      Exit;
  
    FMouseOver := false;
  
    // hier evtl. ein Ereignis erzeugen
  end;


Vielleicht hilft das...


Zuletzt bearbeitet von freedy am Di 09.01.07 11:23, insgesamt 1-mal bearbeitet
Saubäär
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 376



BeitragVerfasst: Di 09.01.07 11:22 
Hi Roy,

meinst du vllt, dass der Eventhandler deaktiviert werden soll, wenn du mit der Mouse auf das Image5 fährst?

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
procedure TForm1.Image5MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
  Label2.Caption:= 'Rechnungen drucken';
  Image5.OnMouseMove := NIL;
end;


Gruß

Saubäär
Roy Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 184

Windows7 Ultimate
Delphi 2007, NET, Embarcadero
BeitragVerfasst: Di 09.01.07 11:38 
Hallo Saubäär,

diesen Code habe ich schon versucht, er löst zwar OnMouseMove aus jedoch nicht das beenden!
Saubäär
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 376



BeitragVerfasst: Di 09.01.07 11:43 
Hi Roy,

merkwürdig! Bei mir funktionierts. Also im Label2 wird 'Rechnungen drucken' angezeigt und danach das OnMouseMove Event deaktiviert!?!

Gruß

Bäär

//EDIT Was genau meinst du mit 'beenden' ??
freedy
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 403
Erhaltene Danke: 1

Winows 7
Delphi XE
BeitragVerfasst: Di 09.01.07 12:55 
user profile iconSaubäär hat folgendes geschrieben:
Hi Roy,

merkwürdig! Bei mir funktionierts. Also im Label2 wird 'Rechnungen drucken' angezeigt und danach das OnMouseMove Event deaktiviert!?!

Gruß

Bäär

//EDIT Was genau meinst du mit 'beenden' ??


Ja, natürlich... nur wenn er dann wieder über das Bild geht, wird der String nicht mehr angezeigt. Ich kann mir vorstellen, dass du verschiedene Images hast und je nachdem über welchem du stehst, möchtest du einen anderen String ausgeben, richtig?

Probier's mit meiner Lösung. Klappt 100%ig. Wenn du noch Fragen hast, poste einfach.
GTA-Place
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
EE-Regisseur
Beiträge: 5248
Erhaltene Danke: 2

WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
BeitragVerfasst: Di 09.01.07 12:59 
Ihr versteht ihn (fast) alle falsch. Er möchte nicht das Event deaktivieren, er möchte das Label leeren, wenn er das Bild verlässt und genau das sollte mit dem Source von freedy gehen.

_________________
"Wer Ego-Shooter Killerspiele nennt, muss konsequenterweise jeden Horrorstreifen als Killerfilm bezeichnen." (Zeit.de)
Roy Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 184

Windows7 Ultimate
Delphi 2007, NET, Embarcadero
BeitragVerfasst: Di 09.01.07 13:05 
Ich versuche es mal, vielen Dank.