mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-19 09:09:32 +02:00
Win32: make ListView columns not-clickable if ColumnClick is False. Issue #40787.
This commit is contained in:
parent
d6b0e5c07d
commit
57bb5a13e1
@ -12,7 +12,7 @@
|
|||||||
{ TWin32WSCustomListView }
|
{ TWin32WSCustomListView }
|
||||||
|
|
||||||
type
|
type
|
||||||
TLVStyleType = (lsStyle, lsInvert, lsExStyle);
|
TLVStyleType = (lsStyle, lsInvert, lsExStyle, lsRecreate);
|
||||||
|
|
||||||
const
|
const
|
||||||
LV_STYLES: array[TListViewProperty] of record
|
LV_STYLES: array[TListViewProperty] of record
|
||||||
@ -21,7 +21,7 @@ const
|
|||||||
end = (
|
end = (
|
||||||
(StyleType: lsStyle; Style: LVS_AUTOARRANGE), // lvpAutoArrange
|
(StyleType: lsStyle; Style: LVS_AUTOARRANGE), // lvpAutoArrange
|
||||||
(StyleType: lsExStyle; Style: LVS_EX_CHECKBOXES), // lvpCheckboxes
|
(StyleType: lsExStyle; Style: LVS_EX_CHECKBOXES), // lvpCheckboxes
|
||||||
(StyleType: lsInvert; Style: LVS_NOSORTHEADER), // lvpColumnClick
|
(StyleType: lsRecreate;Style: LVS_NOSORTHEADER), // lvpColumnClick
|
||||||
(StyleType: lsExStyle; Style: LVS_EX_FLATSB), // lvpFlatScrollBars
|
(StyleType: lsExStyle; Style: LVS_EX_FLATSB), // lvpFlatScrollBars
|
||||||
(StyleType: lsExStyle; Style: LVS_EX_HEADERDRAGDROP), // lvpFullDrag
|
(StyleType: lsExStyle; Style: LVS_EX_HEADERDRAGDROP), // lvpFullDrag
|
||||||
(StyleType: lsExStyle; Style: LVS_EX_GRIDLINES), // lvpGridLines
|
(StyleType: lsExStyle; Style: LVS_EX_GRIDLINES), // lvpGridLines
|
||||||
@ -996,6 +996,8 @@ begin
|
|||||||
Flags := Flags or LVS_OWNERDRAWFIXED;
|
Flags := Flags or LVS_OWNERDRAWFIXED;
|
||||||
if TCustomListView(AWinControl).BorderStyle = bsSingle then
|
if TCustomListView(AWinControl).BorderStyle = bsSingle then
|
||||||
FlagsEx := FlagsEx or WS_EX_CLIENTEDGE;
|
FlagsEx := FlagsEx or WS_EX_CLIENTEDGE;
|
||||||
|
if not TCustomListViewAccess(AWinControl).ColumnClick then
|
||||||
|
Flags := Flags or LVS_NOSORTHEADER;
|
||||||
end;
|
end;
|
||||||
// create window
|
// create window
|
||||||
FinishCreateWindow(AWinControl, Params, false);
|
FinishCreateWindow(AWinControl, Params, false);
|
||||||
@ -1402,7 +1404,6 @@ class procedure TWin32WSCustomListView.SetProperty(const ALV: TCustomListView; c
|
|||||||
begin
|
begin
|
||||||
if not WSCheckHandleAllocated(ALV, 'SetProperty')
|
if not WSCheckHandleAllocated(ALV, 'SetProperty')
|
||||||
then Exit;
|
then Exit;
|
||||||
|
|
||||||
case LV_STYLES[AProp].StyleType of
|
case LV_STYLES[AProp].StyleType of
|
||||||
lsStyle: begin
|
lsStyle: begin
|
||||||
if AIsSet
|
if AIsSet
|
||||||
@ -1418,16 +1419,20 @@ begin
|
|||||||
if (AProp = lvpReadOnly) then
|
if (AProp = lvpReadOnly) then
|
||||||
UpdateStyle(ALV.Handle, LV_STYLES[AProp].Style, 0)
|
UpdateStyle(ALV.Handle, LV_STYLES[AProp].Style, 0)
|
||||||
else
|
else
|
||||||
if AIsSet then
|
begin
|
||||||
UpdateStyle(ALV.Handle, LV_STYLES[AProp].Style, 0)
|
if AIsSet
|
||||||
else
|
then UpdateStyle(ALV.Handle, LV_STYLES[AProp].Style, 0)
|
||||||
UpdateStyle(ALV.Handle, LV_STYLES[AProp].Style, LV_STYLES[AProp].Style);
|
else UpdateStyle(ALV.Handle, LV_STYLES[AProp].Style, LV_STYLES[AProp].Style);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
lsExStyle: begin
|
lsExStyle: begin
|
||||||
if AIsSet
|
if AIsSet
|
||||||
then UpdateExStyle(ALV.Handle, LV_STYLES[AProp].Style, LV_STYLES[AProp].Style)
|
then UpdateExStyle(ALV.Handle, LV_STYLES[AProp].Style, LV_STYLES[AProp].Style)
|
||||||
else UpdateExStyle(ALV.Handle, LV_STYLES[AProp].Style, 0);
|
else UpdateExStyle(ALV.Handle, LV_STYLES[AProp].Style, 0);
|
||||||
end;
|
end;
|
||||||
|
lsRecreate: begin
|
||||||
|
ReCreateWnd(ALV);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
if(aProp=lvpCheckboxes)and aIsSet
|
if(aProp=lvpCheckboxes)and aIsSet
|
||||||
then ReCreateWnd(ALV)
|
then ReCreateWnd(ALV)
|
||||||
|
Loading…
Reference in New Issue
Block a user