Autor Beitrag
opal_99
Hält's aus hier
Beiträge: 3

XP Professional
Delphi 7.0 Prof.
BeitragVerfasst: Di 29.08.06 15:11 
Hallo,
ich habe in einem Panel u.a. mehrere Comboboxen (vom Typ TDBComboBox). Ich möchte nun prüfen, ob eine dieser Comboboxen leer ist und falls ja, den Focus drauflegen.
Das Prüfen funktioniert, nur mit dem Setfocus haut's nicht hin.

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
for z_ind1:=0 to (Panel3.controlcount - 1) do
begin
if (Panel3.controls[z_ind1].ClassType = TDBComboBox) and (Panel3.controls[z_ind1].GetTextLen = 0) then
begin
showmessage('Bitte Wert auswählen!');
//
//   Hier müsste der Focus gesetzt werden 
//   Panel3.controls[z_ind1].SetFocus   geht nicht!!!
//
exit;
end;
end;


Kann jemand bitte weiterhelfen?

Moderiert von user profile iconraziel: Delphi-Tags hinzugefügt
Marco D.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: Di 29.08.06 15:13 
Was meinst du genau mit "Geht nicht"?

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
opal_99 Threadstarter
Hält's aus hier
Beiträge: 3

XP Professional
Delphi 7.0 Prof.
BeitragVerfasst: Di 29.08.06 15:19 
Compiler meckert:
[Fehler] UOPOA.pas(607): Undefinierter Bezeichner: 'Setfocus'
PLuS
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 98

Win XP, Suse Linux 9.0
D5 Standard, D2005 Personal; Perl; PureBasic
BeitragVerfasst: Di 29.08.06 15:29 
Funktioniert denn:

ausblenden Delphi-Quelltext
1:
TDBComboBox(Panel3.controls[z_ind1]).SetFocus;					


Die Controls vom Panel sollten ja eigentlich vom Typ TControl sein und der hat die Methode "SetFocus" nicht!

_________________
Der letzte macht die Tür zu!
opal_99 Threadstarter
Hält's aus hier
Beiträge: 3

XP Professional
Delphi 7.0 Prof.
BeitragVerfasst: Di 29.08.06 15:34 
Danke. Das war's!

Jetzt funktionierts wunderbar.