Autor Beitrag
JayK
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1013



BeitragVerfasst: Sa 14.05.05 11:52 
Hallo,

ist es irgentwie möglich, in einer ComboBox eine Trennlinie zwischen 2 Items einzufügen?
Also ich meine einen Trennstrrich, den man nicht auswählen kann. Bei ItemIndex soll er aber als Eintrag angesehen werden.
Beispiel Zeilenauswahl: Trenner für Leerzeilen (Platzhalter)

Schonmal Danke im vorraus,
JayK

EDIT: ItemIndex doch erwünscht (oben verändert)
galagher
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 2562
Erhaltene Danke: 46

Windows 10 Home
Delphi 10.1 Starter, Lazarus 2.0.6
BeitragVerfasst: Sa 14.05.05 19:24 
user profile iconJayK hat folgendes geschrieben:
ist es irgentwie möglich, in einer ComboBox eine Trennlinie zwischen 2 Items einzufügen?


Hallo! So geht's:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
var
  OldIndex: Integer;  //Globale Variable

procedure TForm1.ComboBox1DropDown(Sender: TObject);
begin
 OldIndex := ComboBox1.ItemIndex;
end;

procedure TForm1.ComboBox1Click(Sender: TObject);
begin
 if ComboBox1.Items[ComboBox1.ItemIndex] = '---' then
  ComboBox1.ItemIndex := OldIndex;
end;

_________________
gedunstig war's - und fahle wornen zerschellten karsig im gestrock. oh graus, es gloomt der jabberwock - und die graisligen gulpen nurmen!
JayK Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1013



BeitragVerfasst: So 15.05.05 14:45 
@galagher:
Danke, so gehts soweit :) .

Schöner wäre aber noch, wenn man gar nicht erst die Striche in die Wahl nehmen könnte, also wie die Trennstriche in Menüs.
Kann man das realisieren? (Und wenn ja wie :mrgreen: ?)
Keldorn
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 2266
Erhaltene Danke: 4

Vista
D6 Prof, D 2005 Pro, D2007 Pro, DelphiXE2 Pro
BeitragVerfasst: So 15.05.05 15:09 
Selberzeichnen, siehe Suche in: Delphi-Forum, Delphi-Library ONDRAWITEM COMBOBOX. Einfach für dieses Item den Hintergrund nicht mit der Selektionsfarbe zeichnen

Mfg Frank

_________________
Lükes Grundlage der Programmierung: Es wird nicht funktionieren.
(Murphy)
JayK Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1013



BeitragVerfasst: So 15.05.05 16:59 
user profile iconKeldorn hat folgendes geschrieben:
Selberzeichnen, siehe Suche in: Delphi-Forum, Delphi-Library ONDRAWITEM COMBOBOX. Einfach für dieses Item den Hintergrund nicht mit der Selektionsfarbe zeichnen

Tschuldige, aber bevor ich es ausprobiere:
Dann könnte der Benutzer aber immer noch draufklicken, oder? Es wird ja nur die Auswahl nicht gezeichnet, sie ist nur nicht sichtbar, aber immer noch vorhanden.
Das will ich ja nicht.