gpt4 book ai didi

delphi - FMX TListbox(Grid Metropolis UI)中的项目选择不正确

转载 作者:行者123 更新时间:2023-12-02 04:00:13 27 4
gpt4 key购买 nike

我遇到了在我的应用程序中使用表单中的 TListBox 时,在 HorzScrollBox 中选择不正确的项目的问题。该表单上有两个(或更多)TListBox。它们彼此远离放置,使得它们的绝对左坐标差大于当前设备屏幕宽度的宽度。该错误出现在以下用户操作序列中。

  1. 从左侧 TListBox 中选择了一个项目
  2. HorzScrollBox 向右滚动,第二个 TListBox 对用户可见,而左侧则不可见。
  3. HorzScrollBox 向左滚动。
  4. 从左侧 TListBox 中选择了一个新项目。

我们得到如下图:新项目已被选中,但即使我们上下滚动框,所选内容仍会绘制在先前所选项目的位置上。 enter image description here

可以通过非常简单的方式重现该错误。

  1. 创建一个新的 Grid MetropolisUI 应用程序。
  2. 将左侧的标准 TListBox 替换为新的(速度会更快)。
  3. 将表单宽度设置为大于屏幕宽度
  4. 将第二个新 TListBox 放置在 HorzScrollBox 中,这样左右 TListboxes 就不会同时看到,并且只有在滚动 HorzScrollBox 后才可以选择项目。
  5. 从任何来源(例如两个 TPrototypeBindSource )填充它们,并将创建的 ListItemStyleLinkFieldControlToField 属性设置为 MetropolisUI

完成。当您运行该应用程序时,您会遇到问题。仅当您滚动 HorzScrollBox 时才会出现该错误,这样当您在第一个 ListBox 中选择某个项目时就不会看到第二个 HorzScrollBox。否则,将正确选择项目(即使您滚动 ojit_code )。这是表单的资源(除了样式的二进制文件,它需要存在才能重现错误)。

object GridViewForm: TGridViewForm
Left = 0
Top = 0
Caption = 'Grid Form'
ClientHeight = 946
ClientWidth = 2600
StyleBook = StyleBook2
FormFactor.Width = 1280
FormFactor.Height = 1024
FormFactor.Devices = [dkDesktop]
FormFamily = 'Main'
FullScreen = True
OnMouseUp = FormMouseUp
Touch.InteractiveGestures = [igPan]
OnGesture = FormGesture
DesignerMobile = False
DesignerWidth = 0
DesignerHeight = 0
DesignerDeviceName = ''
DesignerOrientation = 0
DesignerOSVersion = ''
object MainLayout: TLayout
Align = alContents
Height = 921.000000000000000000
Margins.Top = 25.000000000000000000
Width = 2600.000000000000000000
object HorzScrollBox1: THorzScrollBox
Align = alClient
Height = 921.000000000000000000
TabOrder = 0
Width = 2600.000000000000000000
object GroupLayout1: TLayout
Align = alLeft
Anchors = [akLeft, akTop]
Height = 905.000000000000000000
Margins.Left = 110.000000000000000000
Position.X = 110.000000000000000000
Width = 540.000000000000000000
object ListBox4: TListBox
Align = alClient
Height = 905.000000000000000000
StyleLookup = 'collectionlistbox'
TabOrder = 0
Width = 540.000000000000000000
DefaultItemStyles.ItemStyle = ''
DefaultItemStyles.GroupHeaderStyle = ''
DefaultItemStyles.GroupFooterStyle = ''
end
end
object GroupLayout2: TLayout
Align = alLeft
Anchors = [akLeft, akTop]
Height = 905.000000000000000000
Margins.Left = 40.000000000000000000
Position.X = 690.000000000000000000
Width = 1225.000000000000000000
end
object Layout1: TLayout
Align = alLeft
Anchors = [akLeft, akTop]
Height = 905.000000000000000000
Margins.Left = 40.000000000000000000
Margins.Right = 100.000000000000000000
Position.X = 1955.000000000000000000
Width = 660.000000000000000000
object Label1: TLabel
Align = alTop
AutoSize = True
Height = 40.000000000000000000
Margins.Left = 10.000000000000000000
Margins.Bottom = 5.000000000000000000
Position.X = 10.000000000000000000
StyleLookup = 'pagesubheaderlabel'
Text = 'Group Title: 4'
Width = 165.000000000000000000
WordWrap = False
end
object ListBox1: TListBox
Align = alClient
Height = 855.000000000000000000
StyleLookup = 'collectionlistbox'
TabOrder = 1
Width = 660.000000000000000000
DefaultItemStyles.ItemStyle = ''
DefaultItemStyles.GroupHeaderStyle = ''
DefaultItemStyles.GroupFooterStyle = ''
end
end
end
end
object StyleBook2: TStyleBook
Left = 632
Top = 544
ResourcesBin = {...}
end
object PrototypeBindSource1: TPrototypeBindSource
AutoActivate = True
AutoPost = False
FieldDefs = <
item
Name = 'ContactBitmapL1'
FieldType = ftBitmap
Generator = 'ContactBitmapsL'
ReadOnly = False
end
item
Name = 'ContactName1'
Generator = 'ContactNames'
ReadOnly = False
end
item
Name = 'IntField1'
FieldType = ftInteger
Generator = 'Integers'
ReadOnly = False
end>
ScopeMappings = <>
Left = 1288
Top = 456
end
object BindingsList1: TBindingsList
Methods = <>
OutputConverters = <>
Left = 20
Top = 5
object LinkFillControlToField1: TLinkFillControlToField
Category = 'Quick Bindings'
Control = ListBox4
Track = True
FillDataSource = PrototypeBindSource1
FillDisplayFieldName = 'ContactName1'
AutoFill = True
BufferCount = -1
AutoBufferCount = False
ListItemStyle = 'MetropolisUI'
FillExpressions = <
item
SourceMemberName = 'ContactBitmapL1'
ControlMemberName = 'Icon'
end
item
SourceMemberName = 'IntField1'
ControlMemberName = 'SubTitle'
end>
FillHeaderExpressions = <>
FillBreakGroups = <>
end
object LinkFillControlToField2: TLinkFillControlToField
Category = 'Quick Bindings'
Control = ListBox1
Track = True
FillDataSource = PrototypeBindSource2
FillDisplayFieldName = 'ContactName1'
AutoFill = True
BufferCount = -1
AutoBufferCount = False
ListItemStyle = 'MetropolisUI'
FillExpressions = <
item
SourceMemberName = 'FloatField1'
ControlMemberName = 'SubTitle'
end
item
SourceMemberName = 'ContactBitmap1'
ControlMemberName = 'Icon'
end>
FillHeaderExpressions = <>
FillBreakGroups = <>
end
end
object PrototypeBindSource2: TPrototypeBindSource
AutoActivate = True
AutoPost = False
FieldDefs = <
item
Name = 'ContactBitmap1'
FieldType = ftBitmap
Generator = 'ContactBitmaps'
ReadOnly = False
end
item
Name = 'ContactName1'
Generator = 'ContactNames'
ReadOnly = False
end
item
Name = 'FloatField1'
FieldType = ftSingle
Generator = 'Floats'
ReadOnly = False
end>
ScopeMappings = <>
Left = 1232
Top = 448
end
end

有人对如何应对这个问题有什么建议吗?

最佳答案

我通过设置 ListBox1.CanFocus := false; 找到了答案。在某些情况下(实际上)该错误会再次出现。

关于delphi - FMX TListbox(Grid Metropolis UI)中的项目选择不正确,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31723344/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com