473,394 Members | 1,703 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Comportamiento de ListView en Pantalla

Hola Foro!, tengo una rutina que permite agregar varios elementos o
items de una sola vez en un ListView. Lo que sucede es que en el
momento que se añaden los items al ListView se pone todo blanco,
cuando se terminan de agregar los items vuelve a su estado normal. Como
impido que esto suceda ?. Gracias Mil.

Jul 10 '06 #1
4 3841
Translated:
Hello Forum! I have a routine that allows to add several elements or items
at one time in a ListView. What happens is that at the moment that it adds
the items to the ListView it puts all target, when they are finished adding
the items returns to its normal state. As I prevent that this happens. Thanks
Thousands.

Not sure if this will help, but you got it.
Peter
--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"firefox" wrote:
Hola Foro!, tengo una rutina que permite agregar varios elementos o
items de una sola vez en un ListView. Lo que sucede es que en el
momento que se añaden los items al ListView se pone todo blanco,
cuando se terminan de agregar los items vuelve a su estado normal. Como
impido que esto suceda ?. Gracias Mil.

Jul 11 '06 #2
Gracias! (^_^) -Thanks!

Peter ha escrito:
Translated:
Hello Forum! I have a routine that allows to add several elements or items
at one time in a ListView. What happens is that at the moment that it adds
the items to the ListView it puts all target, when they are finished adding
the items returns to its normal state. As I prevent that this happens. Thanks
Thousands.

Not sure if this will help, but you got it.
Peter
--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"firefox" wrote:
Hola Foro!, tengo una rutina que permite agregar varios elementos o
items de una sola vez en un ListView. Lo que sucede es que en el
momento que se añaden los items al ListView se pone todo blanco,
cuando se terminan de agregar los items vuelve a su estado normal. Como
impido que esto suceda ?. Gracias Mil.
Jul 11 '06 #3

firefox wrote:
Hola Foro!, tengo una rutina que permite agregar varios elementos o
items de una sola vez en un ListView. Lo que sucede es que en el
momento que se añaden los items al ListView se pone todo blanco,
cuando se terminan de agregar los items vuelve a su estado normal. Como
impido que esto suceda ?. Gracias Mil.
Translated again:
Hello Forum! I have a method that adds various rows or items all at
once to a ListView. What happens is that when adding the items to the
ListView it goes completely blank. When the items are all added to the
list view everything returns to normal. How can I prevent this from
happening? Thanks very much.

My response:
I have the same problem. I know why it happens, but because of the
structure of my application I haven't figured out exactly how I'm going
to solve it.

The first thing to understand is that unless you do something special
with Threads, all of the processing you do is in the user interface
(UI) thread, and while you are doing work, the Form cannot redraw
itself, so it appears frozen on the screen. It may go blank, or it may
retain the image of something that was moved over top of it, or it may
stay intact but simply not respond.

In my case, I'm building arrays of columnar data, then creating
thousands of ListViewItem objects, one from each array, and then adding
the ListViewItems to the ListView, all in one operation. This causes
the UI thread to block for an uncomfortable length of time, and the
application "freezes" on the screen.

The solution, as I understand it, is to do as much work as possible on
a background thread. Unfortunately, I don't know whether it's valid to
create a ListViewItem on a background thread, because background
threads cannot make any calls to user interface controls. This may (I
don't know) include not being able to create a new ListViewItem.

Even if I could build everything on a background thread and then only
afterward add it all to the ListView, I still have the problem that
callers to my ListViewForSelfKeyedCollection object (which encapsulates
a ListView) expect to assign a collection of items to the list and then
be able to immediately set SelectedItem, etc. As I said, I need to work
on the program structure.

Does anyone else have a solution to this sort of problem? Is there a
white paper or tutorial out there on dealing with this? I'd appreciate
being pointed in the right direction, as would firefox, I'm sure.

My response translated (badly):
Tengo el mismo problema. Yo se por que sucede, per a cause de la
estructura de mi programa, todavia no tengo solucion.

Hay que intender que todo las operaciones que haces estan hechas por el
"thread" del UI, a menos que estas usando "Threads". Y si estas
haciendo todo el trabajo en el "thread" del UI, el Form no se puede
dibujar mientras. Entonces, parace "conjelado", o posibilmente se
borra, o simplemente no responde.

En mi caso, estoy construiendo "arrays" de data columnar, y despues
creando miles de ListViewItem, cada uno de uno de los "arrays", y
despues anadandoles al ListView, todo de una vez. Asi el "thread" del
UI esta bloqueado para un tiempo largo, que se nota, y mi programa
"congela" para un largo tiempo.

La solucion, como lo entiendo, es hacer el maximo trabajo en un
"background thread". Tristemente, no se si vale crear un ListViewItem
en el "background", por que un "background thread" esta prohibido
accessar a elementos del UI (Controls).

Aunque podria crear todo en un "background thread" y solo despues
anadirlo todo al ListView, tengo siempre el problema que los que usan
mi ListViewForSelfKeyedCollection (que encierra un ListView) van a
esperar que puedan anadir los elementos del ListView y inmediatemente
selectionar uno, etc. Necesito trabajor en la estructura de mi programa.

Jul 11 '06 #4
OK (x x).

Bruce Wood ha escrito:
firefox wrote:
Hola Foro!, tengo una rutina que permite agregar varios elementos o
items de una sola vez en un ListView. Lo que sucede es que en el
momento que se añaden los items al ListView se pone todo blanco,
cuando se terminan de agregar los items vuelve a su estado normal. Como
impido que esto suceda ?. Gracias Mil.

Translated again:
Hello Forum! I have a method that adds various rows or items all at
once to a ListView. What happens is that when adding the items to the
ListView it goes completely blank. When the items are all added to the
list view everything returns to normal. How can I prevent this from
happening? Thanks very much.

My response:
I have the same problem. I know why it happens, but because of the
structure of my application I haven't figured out exactly how I'm going
to solve it.

The first thing to understand is that unless you do something special
with Threads, all of the processing you do is in the user interface
(UI) thread, and while you are doing work, the Form cannot redraw
itself, so it appears frozen on the screen. It may go blank, or it may
retain the image of something that was moved over top of it, or it may
stay intact but simply not respond.

In my case, I'm building arrays of columnar data, then creating
thousands of ListViewItem objects, one from each array, and then adding
the ListViewItems to the ListView, all in one operation. This causes
the UI thread to block for an uncomfortable length of time, and the
application "freezes" on the screen.

The solution, as I understand it, is to do as much work as possible on
a background thread. Unfortunately, I don't know whether it's valid to
create a ListViewItem on a background thread, because background
threads cannot make any calls to user interface controls. This may (I
don't know) include not being able to create a new ListViewItem.

Even if I could build everything on a background thread and then only
afterward add it all to the ListView, I still have the problem that
callers to my ListViewForSelfKeyedCollection object (which encapsulates
a ListView) expect to assign a collection of items to the list and then
be able to immediately set SelectedItem, etc. As I said, I need to work
on the program structure.

Does anyone else have a solution to this sort of problem? Is there a
white paper or tutorial out there on dealing with this? I'd appreciate
being pointed in the right direction, as would firefox, I'm sure.

My response translated (badly):
Tengo el mismo problema. Yo se por que sucede, per a cause de la
estructura de mi programa, todavia no tengo solucion.

Hay que intender que todo las operaciones que haces estan hechas por el
"thread" del UI, a menos que estas usando "Threads". Y si estas
haciendo todo el trabajo en el "thread" del UI, el Form no se puede
dibujar mientras. Entonces, parace "conjelado", o posibilmente se
borra, o simplemente no responde.

En mi caso, estoy construiendo "arrays" de data columnar, y despues
creando miles de ListViewItem, cada uno de uno de los "arrays", y
despues anadandoles al ListView, todo de una vez. Asi el "thread" del
UI esta bloqueado para un tiempo largo, que se nota, y mi programa
"congela" para un largo tiempo.

La solucion, como lo entiendo, es hacer el maximo trabajo en un
"background thread". Tristemente, no se si vale crear un ListViewItem
en el "background", por que un "background thread" esta prohibido
accessar a elementos del UI (Controls).

Aunque podria crear todo en un "background thread" y solo despues
anadirlo todo al ListView, tengo siempre el problema que los que usan
mi ListViewForSelfKeyedCollection (que encierra un ListView) van a
esperar que puedan anadir los elementos del ListView y inmediatemente
selectionar uno, etc. Necesito trabajor en la estructura de mi programa.
Jul 11 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Anushya | last post by:
Hi I am using Listview and inherited listview control overriding WndProc & PreProcessMessage in ListView. I need this to customize listview to display only the page the user scrolls to. Since i...
0
by: Anushya | last post by:
Hi I am using Listview and inherited listview control overriding WndProc & PreProcessMessage in ListView. I need this to customize listview to display only the page the user scrolls to. Since i...
6
by: VM | last post by:
How can I fill up a listview with text file contents? My listview has two columns and the first column fills up with a while loop: while (myString != null) { myString = sr.Readline();...
0
by: keith | last post by:
In a ListView control (two columns), I added a few ListView items. ListView listview=new ListView(); listview.Parent=this; listview.View=View.Details; listview.Columns.Add...
7
by: Dave Y | last post by:
I am a newbie to C# and am having trouble trying to override a ListView property method. I have created a new class derived from the Forms.Listview and I cannot figure out the syntax to override...
7
by: BobAchgill | last post by:
I am trying to decide which of these controls to use to implement letting my user select a full row from MyList. The MyList has several columns which would be nice to sort by at run time. The...
2
by: Ben H | last post by:
Hello all I'm using a listview in my app but I want to scroll the listview programatically as I hate the look of the standard scrollbar. So, the listview is scrolled programatically using...
2
by: Peter | last post by:
Hi, I have a problem with Listview using checkboxes. If i check items by code BEFORE the form is shown the Listview.Items are confused during the ItemChecked Event !!! After showing the...
4
by: Brian Gaze | last post by:
I have created a ListView control and have bound this to a datasource. Within the ItemTemplate of the ListView I have added another ListViewControl which is databound in the code behind. The idea...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.