473,719 Members | 2,892 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3859
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 ListViewForSelf KeyedCollection 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 ListViewForSelf KeyedCollection (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 ListViewForSelf KeyedCollection 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 ListViewForSelf KeyedCollection (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
2626
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 am populating listview with more than 200,000 items. It is too slow and tried virtual listview. But that doesnot allow me to add images in the listview. So now trying to list only the page user scrolls to.
0
489
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 am populating listview with more than 200,000 items. It is too slow and tried virtual listview. But that doesnot allow me to add images in the listview. So now trying to list only the page user scrolls to.
6
4654
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(); listView1.Items.Add (myString); } Is there a way I can fill up the second column this easily? Thw way I'm currently doing it is using the subitems property to add it. Unfortunately,
0
2225
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 ("Col1",200,HorizontalAlignment.Left); listview.Columns.Add ("Col2",800,HorizontalAlignment.Left);
7
6448
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 ListView.Items.Add(), . I see that it is a virtual method so it should be easy to do. If anyone can help I would appreciate it greatly. I can do what I need to do in a different way this would just make everything significantly cleaner and eaasier...
7
15001
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 MyList data is resident in a dataset table. I'm stuck and can't choose either because. If I choose ListView as my control I don't understand how to programmatically get the data from the dataset table
2
4093
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 ensurevisible, ie the listview shows a maximum of 6 items and if I want to scroll down one I use the code... listview.ensurevisible(listview.TopItem.Index + 6)
2
6829
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 form every thing works fine: checking items by code
4
4510
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 is that when clicking on the "Show details" button the ListView for the appropriate row binds in the codebehind and displays the detail data for the selected row. I did something similar with a gridview control previously, but want to be able to...
0
8833
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9365
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9210
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9055
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7998
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6661
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5972
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4482
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3186
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.