Autor Beitrag
rmasterb
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 71



BeitragVerfasst: Mo 12.05.03 20:17 
wie bekomme ich heraus wie der name eines fokusierten editfeldes ist??

Moderiert von user profile iconTino: Titel geändert.
JacFab
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 111



BeitragVerfasst: Mo 12.05.03 20:43 
soweit ich weiß kannst du mit getfocus das hwnd des fokussierten objektes rauskriegen. mit findobject bekommst du dann aus der hwnd das markierte objekt. dann brauchst du nur noch mit
ausblenden Quelltext
1:
tobject.name					

den namen rauskriegen.

---dies ist nicht getest----
muss aber eigentlich gehen!

Moderiert von user profile iconTino: Absätze entfernt & Code-Tags hinzugefügt.

_________________
Nur Sitte und Moral sind Anker im Strom der Verrohung!
;)
rmasterb Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 71



BeitragVerfasst: Di 13.05.03 20:38 
die procedure findobject gibt es nicht :-(
Blackout
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 64



BeitragVerfasst: Di 13.05.03 21:28 
hi rmasterb,
du muss in jedem Edit im ereignis "OnEnter" die Komponente Global als Variable Speichern sonst gehts glaub ich nicht
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
Var
    LastControl: TComponent; // Global

{...}

Procedure TForm1.FormCreate(Sender: TObject);
Begin

  LastControl:= Nil;

End;


// mit jedem Edit
Procedure TForm1.Edit1OnEnter(Sender: TObject);
Begin

    LastControl:= Sender as TComponent;

End;

und erfragen kannst du das ganze dann so:
ausblenden Delphi-Quelltext
1:
2:
If Assigned(LastControl) Then
  Form1.Label1.Caption:= LastControl.Name;

Ne andere möglichkeit kenn ich leider nicht :?

_________________
MfG Blackout
JacFab
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 111



BeitragVerfasst: Di 13.05.03 22:45 
doch die funktion gibt es.. guck mal in der hilfe nach!

_________________
Nur Sitte und Moral sind Anker im Strom der Verrohung!
;)
Blackout
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 64



BeitragVerfasst: Di 13.05.03 23:59 
So hab ne weitere und bessere Lösung allerdings ist die nur besser wenn man das Aktive Edit per Code erfragt. Wenn du dies aber per Buttonklick wissen möchtest würde vielleicht nen Timer abhilfe schaffen was aber nicht sehr schön wäre.
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
Var
  C: TComponent;
  I: Integer;
  
Begin

  For I:= 1 To 2 Do  // bis Edit2
    Begin
      C:= Form1.FindComponent('Edit'+IntToStr(I));
      If (C AS TEdit).Focused Then Break;
    End;
    
  // C.Name ist das aktuell Fokusierte Edit (z.B. 'Edit2')
  Form1.Label1.Caption:= C.Name;

End;

_________________
MfG Blackout
rmasterb Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 71



BeitragVerfasst: Mi 14.05.03 08:50 
danke erst mal für die antworten.
ich möchte mal ganz kurz auf die findobject funktion zurückkommen.
hattest du dir das so vorgestellt??:
ausblenden Quelltext
1:
findobject(getfocus)					

wenn ja HWND und QObjectH sind nicht kompartiebel :-( ,leider.
ich denke du wirst mir sicher sagen können wie ich mit dem findobject umgehen muß.
rmasterb Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 71



BeitragVerfasst: Mi 14.05.03 14:01 
@Blackout:
ich hab dein code ausprobiert und der sieht eigentlich auch schlüssig aus aber Lastcontrol.name leifert '' wieder.

hmmm? ich hab mich eigentlich an deine beschreibung gehalten
rmasterb Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 71



BeitragVerfasst: Mi 14.05.03 14:12 
vieleicht hilft es zu wissen, dass ich meine editfelder dynamisch als 3d-array deklariert habe und ich die onenter procedure selber zuweisen muß(was ich natürlich gemacht habe)
Blackout
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 64



BeitragVerfasst: Mi 14.05.03 14:17 
am besten du benutzt den 2ten Code von mir der is besser. Da brauchste auch keine OnEnter proceduren

_________________
MfG Blackout
rmasterb Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 71



BeitragVerfasst: Mi 14.05.03 17:20 
ich bin gerade auf eine kleine seltsame sache gestoßen:
wenn ich ein editfeld dynamisch erstelle funktionieren manche eigenschaften nicht. zB: die onEnter methode, die Taborder, etc
gibt es da eine eigenschaft die ich auf true setzen muß, um es zum laufen zu bringen?

---> das ist übrigens auch der Grund warum keiner eurer codes funktioniert
Raphael O.
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1596


VS 2013
BeitragVerfasst: Mi 14.05.03 17:29 
du musst halt beim ertsellen des editfeldes dem entsprechendem Ereigniss eine andre Prozedur zuordnen, die dann irgendwas macht...
rmasterb Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 71



BeitragVerfasst: Mi 14.05.03 19:31 
Titel: ok
sorry ich hab mich vieleicht ein wenig doof ausgedrückt. ich meinen auch wenn ich der onEnter methode eine procedure zuweise funzt es nicht

ausblenden Quelltext
1:
Edit1.onEnter := onEnter					


man darf davon ausgehen, dass ich die onEnter procedure deklariert hab
Simon Joker
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 236
Erhaltene Danke: 1



BeitragVerfasst: Do 15.05.03 11:32 
Hi wie war es eigentlich mit:
ausblenden Delphi-Quelltext
1:
2:
if ActiveControl <> nil then
  ShowMessage(ActiveControl.Name);

Gibt den Namen des focusierten Controls aus. Aufgerufen kann es von jeglichem Element was nicht selbst den Focus bekommen (Sonst gibts den Namen des entsprechendenControls) kann oder irgentwo im Code.