Home > Back-end >  Dynamically created controls how to follow the scroll bar?
Dynamically created controls how to follow the scroll bar?

Time:11-18



Listview inside dynamically create the ListItem also create corresponding combobox, how can with ListItem binding, rolling together, to create the code is as follows:


 
Var
LItem: TListItem;
Combox: TComboBox;
Num: integer;
R: TRect;

LItem:=ListView1. Items. The Add;
LItem. Caption:='content';
LItem. SubItems. Add (IntToStr (num));//as a serial number
//determine the position of the drop-down selection box
R:=lItem DisplayRect (drBounds);
R.L eft:=r.L eft + ListView1. Columns [0]. The Width;
R.R d.light:=r.L eft + ListView1. Columns [1]. The Width - 8;
Combox:=TComboBox. Create (self);
Combox. Parent:=ListView1;
Combox. Items. Assign (tList);
Combox. Style:=csDropDownList;
Combox. ItemIndex:=0;
Combox. Name:='com + IntToStr (num);
Combox. Tag:=num;
Combox. BoundsRect:=R;
Combox. Visible:=True;

CodePudding user response:

You R a fixed,

CodePudding user response:

I have one idea, at the time of the mouse to click form grid, dynamically generated (or display) a ComboBox to cover on the grid, when the ComboBox choices, assigned to the grid and delete (or hidden),

CodePudding user response:


Is very strange oh?

CodePudding user response:

BBS after revision bug, I'm not surprised.

CodePudding user response:

refer to the second floor u010165006 response:
I have an idea, at the time of the mouse to click form grid, dynamically generated (or display) a ComboBox to cover on the grid, when the ComboBox choices, assigned to the grid and delete (or hidden),


support

CodePudding user response:

R: TRect; This variable is placed in the global can be achieved,

CodePudding user response:

R: TRect; This variable is placed in the global can be achieved,
  • Related