ibrobar
asked on
ListView
Hi All
My question is :
I am having a listview statring with 5 columns and I am filling it from a table or a query.During runtime I might Add new columns and i want to fill that specific columns with it's assigned data from the table without refilling the entire listview.
please anyone got a solution.
one more thing, what is the way to save a user layout for a listview , so each user can use his own layout for the columns in the listview
best regards
My question is :
I am having a listview statring with 5 columns and I am filling it from a table or a query.During runtime I might Add new columns and i want to fill that specific columns with it's assigned data from the table without refilling the entire listview.
please anyone got a solution.
one more thing, what is the way to save a user layout for a listview , so each user can use his own layout for the columns in the listview
best regards
that is not enough as setlength will only create the array but not initialize the listviews.
you will also have to
var ListName:array of TlistView;
begin
SetLength(ListName,10);
for i:=0 to length(listname0 do
listname[i]:=TListView.Cre ate(this); // for the current form
end;
you will also have to
var ListName:array of TlistView;
begin
SetLength(ListName,10);
for i:=0 to length(listname0 do
listname[i]:=TListView.Cre
end;
hm .. that should teach me to read the question first. so sorry for the above anwser but that is NOT what you want.
you will only have to do something like this:
var l:TlistView; c:TListColumn; i:TCollectionItem;
begin
c:=l.Columns.Add;
c.Caption:='column name';
for all rows to add do
begin
i:=c.Collection.Add;
i.DisplayName:='value';
end;
end;
you will only have to do something like this:
var l:TlistView; c:TListColumn; i:TCollectionItem;
begin
c:=l.Columns.Add;
c.Caption:='column name';
for all rows to add do
begin
i:=c.Collection.Add;
i.DisplayName:='value';
end;
end;
regarding your second question:
you wil lhave to save yourself all data:
- listview sizes
- iterate through all columns and
--- save widths/other data
--- iterate through collection ffrom each column and
------- save all sizes/other data
you wil lhave to save yourself all data:
- listview sizes
- iterate through all columns and
--- save widths/other data
--- iterate through collection ffrom each column and
------- save all sizes/other data
ASKER
thanks ciuly
can i get a DBlistview source code for delphi4 if you have it
regards
can i get a DBlistview source code for delphi4 if you have it
regards
firstly, we cannot give out source code from delphi packages for obvious reasons. if I remember correctly, someone on another topic was working with you on something similiar, is it not?
secondly, your request is kind of off-topic :) and you already have a question open on this matter so you should find a solution there.
secondly, your request is kind of off-topic :) and you already have a question open on this matter so you should find a solution there.
ASKER
YES CIULY
you are right but the person i was working with wasn't able to give me the correct solution , besides that DBListView is not Borland code so we cann't fear copyright here it's a development tool.
thanks any way
you are right but the person i was working with wasn't able to give me the correct solution , besides that DBListView is not Borland code so we cann't fear copyright here it's a development tool.
thanks any way
actually we can fear copyright issues as the code should have some copyright or EULA or whatever. but unless you say which one you talk about, I cannot be sure.
but you are missing the point with that question and that is that you did not say which component you are looking for. there are a TON of DBListView compnents out there. you have to choose one.
OR, if you have one, you must give us information or link to it so that we can see what is the issue with it. we cannot help you unless you help us first by giving the info requested. let's move this discussion to that other thread (https://www.experts-exchange.com/questions/21857751/DBListView.html) for clarification.
also, we can discuss there why this solution (https://www.experts-exchange.com/questions/21857008/Delphi-Source.html) doesn't work for you since you already accepted it.
cheers
but you are missing the point with that question and that is that you did not say which component you are looking for. there are a TON of DBListView compnents out there. you have to choose one.
OR, if you have one, you must give us information or link to it so that we can see what is the issue with it. we cannot help you unless you help us first by giving the info requested. let's move this discussion to that other thread (https://www.experts-exchange.com/questions/21857751/DBListView.html) for clarification.
also, we can discuss there why this solution (https://www.experts-exchange.com/questions/21857008/Delphi-Source.html) doesn't work for you since you already accepted it.
cheers
ASKER
Hi i tried this code
var l:TlistView; c:TListColumn; i:TCollectionItem;
begin
c:=l.Columns.Add;
c.Caption:='column name';
for all rows to add do
begin
i:=c.Collection.Add;
i.DisplayName:='value';
end;
end;
but it didn't work .
regards
var l:TlistView; c:TListColumn; i:TCollectionItem;
begin
c:=l.Columns.Add;
c.Caption:='column name';
for all rows to add do
begin
i:=c.Collection.Add;
i.DisplayName:='value';
end;
end;
but it didn't work .
regards
don't tell me you run that piece of code just the way it is... it was just a sketch, I hope that was obvious. if not for other reason then for the syntactical errors at compilation time.
if you did implement real code based on the sketh you should post it and also metnion what and where is the error so we can help you ;)
if you did implement real code based on the sketh you should post it and also metnion what and where is the error so we can help you ;)
ASKER
Hi Ciuly
Afcourse i didn't use the code as it is . But let me just ask you about the loop: For I:=0 to listview1.items.count-1 do it it right
thanks
regards
Afcourse i didn't use the code as it is . But let me just ask you about the loop: For I:=0 to listview1.items.count-1 do it it right
thanks
regards
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I will try it today
thanks
thanks
you can use a dynamic array of TlistView and create it in runtime something like to this:
var ListName:array of TlistView;
begin
SetLength(ListName,10);
end;