Einzelnen Beitrag anzeigen

Benutzerbild von himitsu
himitsu

Registriert seit: 11. Okt 2003
Ort: Elbflorenz
43.167 Beiträge
 
Delphi 12 Athens
 
#5

AW: ComboBox nach TabStop True/False Text markiert

  Alt 17. Aug 2022, 13:47
Am TabStop selber liegt es garnicht.

Irgendwas im SetWindowLong(GWL_STYLE) bringt das Control durcheinander.


Ob es jetzt an Windows oder irgendwas in der VCL liegt, konnte ich nicht entdecken.
(mit Debug-DCUs bissl durch die VCL und auf die Schnelle nichts bemerkt)


Man könnte jetzt noch mit anderen Sprachen (C++ oder so) das testen,
bzw. mal eine NonVCL-ComboBox erstellen und auch dort schauen.



Aus TComboBox.SetTabStop den relevanten Code rausgeholt und Zeilen einzeln getestet und unwichtiges auskommentiert:
Delphi-Quellcode:
{ ComboBox2.TabStop := Value; }
//PBoolean(@ComboBox2.TabStop)^ := Value;
Style := GetWindowLong(ComboBox2.Handle, GWL_STYLE) {and not WS_TABSTOP};
//if Value then Style := Style or WS_TABSTOP;
SetWindowLong(ComboBox2.Handle, GWL_STYLE, Style);
//ComboBox2.Perform(CM_TABSTOPCHANGED, 0, 0);
Delphi-Quellcode:
Style := GetWindowLong(ComboBox2.Handle, GWL_STYLE);
SetWindowLong(ComboBox2.Handle, GWL_STYLE, Style); // das hier ist Schuld

siehe
Delphi-Quellcode:
procedure TWinControl.SetTabStop(Value: Boolean);
var
  Style: NativeInt;
begin
  if FTabStop <> Value then begin
    FTabStop := Value;
    if HandleAllocated then begin
      Style := GetWindowLong(WindowHandle, GWL_STYLE) and not WS_TABSTOP;
      if Value then Style := Style or WS_TABSTOP;
      SetWindowLong(WindowHandle, GWL_STYLE, Style);
    end;
    Perform(CM_TABSTOPCHANGED, 0, 0);
  end;
end;
Garbage Collector ... Delphianer erzeugen keinen Müll, also brauchen sie auch keinen Müllsucher.
my Delphi wish list : BugReports/FeatureRequests
  Mit Zitat antworten Zitat