Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Programmieren allgemein (https://www.delphipraxis.net/40-programmieren-allgemein/)
-   -   Comboliste klappt nicht auf (https://www.delphipraxis.net/200707-comboliste-klappt-nicht-auf.html)

EWeiss 17. Mai 2019 11:16

Comboliste klappt nicht auf
 
CB_SHOWDROPDOWN hat keine Auswirkung Liste klappt nicht auf.
Kann aber nicht erkennen das irgend etwas falsch ist.

Delphi-Quellcode:
LStyle := WS_CHILD or WS_VISIBLE or WS_TABSTOP or CBS_DROPDOWNLIST or
  CBS_HASSTRINGS or CBS_DISABLENOSCROLL or CBS_OWNERDRAWFIXED or WS_VSCROLL
  or CBS_NOINTEGRALHEIGHT;

HCombo := CreateWindowEx(0, 'COMBOBOX', PWideChar(ColorLabel), LStyle,
  Width - 24, 0, 0, 152, FHColorPicker, DlgItemID, SkinEngine.skInstance,
  nil);

// Speicher das Handle in mein Property.
SkinEngine.SetProperty(FHColorPicker, COLORPICK_COMBO, HCombo);
Delphi-Quellcode:
WM_COMMAND:
  begin
    HCombo := SkinEngine.GetProperty(WinHandle, COLORPICK_COMBO);
    EnableWindow(HCombo, true);
    SendMessage(HCombo, CB_SHOWDROPDOWN, WPARAM(True), 0); // funktioniert nicht warum auch immer.
    SkinColorPicker.PutFocusOn(HCombo);
  end;
gruss

peterbelow 17. Mai 2019 12:16

AW: Comboliste klappt nicht auf
 
Zitat:

Zitat von EWeiss (Beitrag 1432399)
CB_SHOWDROPDOWN hat keine Auswirkung Liste klappt nicht auf.
Kann aber nicht erkennen das irgend etwas falsch ist.

Delphi-Quellcode:
LStyle := WS_CHILD or WS_VISIBLE or WS_TABSTOP or CBS_DROPDOWNLIST or
  CBS_HASSTRINGS or CBS_DISABLENOSCROLL or CBS_OWNERDRAWFIXED or WS_VSCROLL
  or CBS_NOINTEGRALHEIGHT;

HCombo := CreateWindowEx(0, 'COMBOBOX', PWideChar(ColorLabel), LStyle,
  Width - 24, 0, 0, 152, FHColorPicker, DlgItemID, SkinEngine.skInstance,
  nil);

// Speicher das Handle in mein Property.
SkinEngine.SetProperty(FHColorPicker, COLORPICK_COMBO, HCombo);
Delphi-Quellcode:
WM_COMMAND:
  begin
    HCombo := SkinEngine.GetProperty(WinHandle, COLORPICK_COMBO);
    EnableWindow(HCombo, true);
    SendMessage(HCombo, CB_SHOWDROPDOWN, WPARAM(True), 0); // funktioniert nicht warum auch immer.
    SkinColorPicker.PutFocusOn(HCombo);
  end;
gruss

Hat die Combobox den Fokus?

EWeiss 17. Mai 2019 12:20

AW: Comboliste klappt nicht auf
 
Zitat:

Hat die Combobox den Fokus?
Delphi-Quellcode:
SkinColorPicker.PutFocusOn(HCombo);
Wird nachher gesetzt.

Delphi-Quellcode:
HCombo := SkinEngine.GetProperty(WinHandle, COLORPICK_COMBO);
SetFocus(HCombo);
Hat keinen Effekt.

gruss

peterbelow 17. Mai 2019 12:22

AW: Comboliste klappt nicht auf
 
Zitat:

Zitat von EWeiss (Beitrag 1432409)
Zitat:

Hat die Combobox den Fokus?
Delphi-Quellcode:
SkinColorPicker.PutFocusOn(HCombo);
Wird nachher gesetzt.

gruss

Machs vorher.

EWeiss 17. Mai 2019 12:25

AW: Comboliste klappt nicht auf
 
Zitat:

Zitat von peterbelow (Beitrag 1432411)
Zitat:

Zitat von EWeiss (Beitrag 1432409)
Zitat:

Hat die Combobox den Fokus?
Delphi-Quellcode:
SkinColorPicker.PutFocusOn(HCombo);
Wird nachher gesetzt.

gruss

Machs vorher.

bringt nix.

Zusätzlich habe ich noch das Problem das wenn ich den Style CBS_DROPDOWNLIST addiere
dann bekomme ich kein Event auf die Message WM_CTLCOLORLISTBOX.. Hmmmm

gruss

EWeiss 17. Mai 2019 16:27

AW: Comboliste klappt nicht auf
 
Liste der Anhänge anzeigen (Anzahl: 1)
Geht jetzt.. aber nicht mit dem CB_SHOWDROPDOWN denke das ist überflüssig.
Erste Problem war das die Weite der Combo 0 war wenn dem so ist wird die Liste nicht aufgeklappt warum auch immer :)

Delphi-Quellcode:
    HCombo := CreateWindowEx(0, 'COMBOBOX', PWideChar(ColorLabel), LStyle,
      Width - 24, 0, 0, 152, FHColorPicker, DlgItemID, SkinEngine.skInstance,
      nil);
zu
Delphi-Quellcode:
    HCombo := CreateWindowEx(0, 'COMBOBOX', PWideChar(ColorLabel), LStyle,
      Width - 24, 0, 1, 152, FHColorPicker, DlgItemID, SkinEngine.skInstance,
      nil);
Zweite Problem ich musste die alte Position der Combo wieder herstellen bevor sie erneut aufgeklappt wird.
Delphi-Quellcode:
procedure TSkinColorPicker.PutFocusOn(ObjectHandle: HWND);
begin

  PostMessage(ObjectHandle, WM_LBUTTONDOWN, 0, 0);
  PostMessage(ObjectHandle, WM_LBUTTONUP, 0, 0);
end;
Delphi-Quellcode:
WM_COMMAND:
  begin
    HCombo := SkinEngine.GetProperty(WinHandle, COLORPICK_COMBO);
    GetWindowRect(WinHandle, rc);
    SetWindowPos(HCombo, 0, rc.Left, 0, 1, 152, SWP_NOZORDER);
    SkinColorPicker.PutFocusOn(HCombo);
  end;
Ergebnis siehe shot!
Muss noch was an der Hintergrundfarbe machen sowie die Schrift der Combo mit der des Skins ersetzen verwende im Moment TextOut. Wird dann GDI+
Der ColorPicker ändert die Aero Farbe.

gruss

EWeiss 17. Mai 2019 17:21

AW: Comboliste klappt nicht auf
 
grrr... mir fehlt der erste Eintrag.

Zitat:

"AliceBlue, $F0F8FF_" _ ' COLORLABEL
"AntiqueWhite, $FAEBD7_" _ '
"Aqua, $00FFFF_" _ '
"Aquamarine, $7FFFD4_" _ '
"Azure, $F0FFFF_" _ '
"Beige, $F5F5DC_" _ '
"Bisque, $FFE4C4_" _ '
"Black, $000000_" _ '
Ich parse den String auf diese weise.

Delphi-Quellcode:
    if ColorLabel > '' then
    begin
      SetItem := -1;
      Parse := Split(ColorLabel, '_');
      Count := High(Parse);

      R1 := 0;
      G1 := 0;
      B1 := 0;

      for K := 0 to Count - 1 do
      begin
        // Get Color Name
        ColorName := Split(Parse[K], ',');
        CLName := ColorName[Low(ColorName)];
        SendMessage(HCombo, CB_ADDSTRING, 0, LParam(CLName));
        // Get Color Value
        Color := ColorName[High(ColorName)];
        R := Byte(StrToInt('$' + MidStr(Color, 3, 2)));
        G := Byte(StrToInt('$' + MidStr(Color, 5, 2)));
        B := Byte(StrToInt('$' + MidStr(Color, 7, 2)));
        SendMessage(HCombo, CB_SETITEMDATA, K, LParam(RGB(R, G, B)));
       
        if (R = R1) and (G = G1) and (B = B1) then
          SetItem := K;
      end;
      if SetItem > -1 then
        SendMessage(HCombo, CB_SETCURSEL, SetItem, 0);
    end;
Der erste Eintrag 0 wird nicht zur Liste addiert. Warum?

gruss

EWeiss 17. Mai 2019 18:47

AW: Comboliste klappt nicht auf
 
Liste der Anhänge anzeigen (Anzahl: 1)
Hat sich erledigt Danke!

gruss


Alle Zeitangaben in WEZ +1. Es ist jetzt 04:54 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz