Search Results

Search found 8 results on 1 pages for 'objectlistview'.

Page 1/1 | 1 

  • Updating the icons in an ObjectListView

    - by Eric
    I'm using an TreeListView (a sub type of ObjectListView) in my current project. Each item in the list is given an icon, but the icon my vary depending on the state of the item. For example if the item is readonly I want to use an icon with a little lock symbol. When the items are first added to the TreeListView the icons are show correctly, yet later when the state of an item changes the icons are not updating. How do I force the control to regenerate all the icons?

    Read the article

  • How to wordWrap the text in a column using ObjectListView

    - by Tiago
    For example I have a big sentence: "I like to eat pie and have fun around the house all day long!" And I want it to appear like this: "I like to eat pie and have fun around the house all day long!" In this post: http://stackoverflow.com/questions/1673963/multi-line-list-items-on-winforms-listview-control Grammarian said that you only need to have WordWrap on but I cannot find that option. Thanks for the help in advanced

    Read the article

  • how can retrieve a checked list of objects from ObjectListView c#?

    - by Sidaoui Mejdi
    I'm using ObjectListView with checkboxes, I would like to run a function on selected items to delete them. So i tried this Method but it not working: private List<Matricule> matrs; private void button1_Click(object sender, EventArgs e) { //List<Song> s = this.olvSongs.CheckedObjects.Count; //MessageBox.Show(this.olvSongs.CheckedItems.Count + " " + this.olvSongs.CheckedObjects.Count); string s = ""; foreach (var item in olvMatrs.SelectedItems) { matrs.Remove((Matricule)item); } this.olvSongs.SetObjects(matrs); } how can i do this task.

    Read the article

  • ObjectListView: Custom Sorter

    - by Mike
    In the control ObjectListView(http://objectlistview.sourceforge.net/html/cookbook.htm), I'm trying to add a custom sorter where it ignores "The" and "A" prefixes. I managed to do it with a regular ListView, but now that I switched to ObjectListView(a lot more features, and ease), I can't seem to do the same. The following is the Main comparer in the ObjectListView code i think... public int Compare(object x, object y) { return this.Compare((OLVListItem)x, (OLVListItem)y); } Original Sorter for ascending, as an example (Ignoring "A" and "The") public class CustomSortAsc : IComparer { int IComparer.Compare(Object x, Object y) { string[] px = Convert.ToString(x).Split(' '); string[] py = Convert.ToString(y).Split(' '); string newX = ""; string newY = ""; for (int i = 0; i < px.Length; i++) { px[i] = px[i].Replace("{", ""); px[i] = px[i].Replace("}", ""); } for (int i = 0; i < py.Length; i++) { py[i] = py[i].Replace("{", ""); py[i] = py[i].Replace("}", ""); } if ((px[1].ToLower() == "a") || (px[1].ToLower() == "the")) { if (px.Length > 1) { for (int i = 2; i < px.Length; i++) newX += px[i]; } } else { for (int i = 1; i < px.Length; i++) newX += px[i]; } if ((py[1].ToLower() == "a") || (py[1].ToLower() == "the")) { if (py.Length > 1) { for (int i = 2; i < py.Length; i++) newY += py[i]; } } else { for (int i = 1; i < py.Length; i++) newY += py[i]; } return ((new CaseInsensitiveComparer()).Compare(newX, newY)); }

    Read the article

  • python object AttributeError: type object 'Track' has no attribute 'title'

    - by ccwhite1
    I apologize if this is a noob question, but I can't seem to figure this one out. I have defined an object that defines a music track (NOTE: originally had the just ATTRIBUTE vs self.ATTRIBUTE. I edited those values in to help remove confusion. They had no affect on the problem) class Track(object): def __init__(self, title, artist, album, source, dest): """ Model of the Track Object Contains the followign attributes: 'Title', 'Artist', 'Album', 'Source', 'Dest' """ self.atrTitle = title self.atrArtist = artist self.atrAlbum = album self.atrSource = source self.atrDest = dest I use ObjectListView to create a list of tracks in a specific directory ....other code.... self.aTrack = [Track(sTitle,sArtist,sAlbum,sSource, sDestDir)] self.TrackOlv.AddObjects(self.aTrack) ....other code.... Now I want to iterate the list and print out a single value of each item list = self.TrackOlv.GetObjects() for item in list: print item.atrTitle This fails with the error AttributeError: type object 'Track' has no attribute 'atrTitle' What really confuses me is if I highlight a single item in the Object List View display and use the following code, it will correctly print out the single value for the highlighted item list = self.TrackOlv.GetSelectedObject() print list.atrTitle

    Read the article

  • Winforms controls and "generic" events handlers. How can I do this?

    - by Yanko Hernández Alvarez
    In the demo of the ObjectListView control there is this code (in the "Complex Example" tab page) to allow for a custom editor (a ComboBox) (Adapted to my case and edited for clarity): EventHandler CurrentEH; private void ObjectListView_CellEditStarting(object sender, CellEditEventArgs e) { if (e.Column == SomeCol) { ISomeInterface M = (e.RowObject as ObjectListView1Row).SomeObject; //(1) ComboBox cb = new ComboBox(); cb.Bounds = e.CellBounds; cb.DropDownStyle = ComboBoxStyle.DropDownList; cb.DataSource = ISomeOtherObjectCollection; cb.DisplayMember = "propertyName"; cb.DataBindings.Add("SelectedItem", M, "ISomeOtherObject", false, DataSourceUpdateMode.Never); e.Control = cb; cb.SelectedIndexChanged += CurrentEH = (object sender2, EventArgs e2) => M.ISomeOtherObject = (ISomeOtherObject)((ComboBox)sender2).SelectedValue; //(2) } } private void ObjectListView_CellEditFinishing(object sender, CellEditEventArgs e) { if (e.Column == SomeCol) { // Stop listening for change events ((ComboBox)e.Control).SelectedIndexChanged -= CurrentEH; // Any updating will have been down in the SelectedIndexChanged // event handler. // Here we simply make the list redraw the involved ListViewItem ((ObjectListView)sender).RefreshItem(e.ListViewItem); // We have updated the model object, so we cancel the auto update e.Cancel = true; } } I have too many other columns with combo editors inside objectlistviews to use a copy& paste strategy (besides, copy&paste is a serious source of bugs), so I tried to parameterize the code to keep the code duplication to a minimum. ObjectListView_CellEditFinishing is a piece of cake: HashSet<OLVColumn> cbColumns = new HashSet<OLVColumn> (new OLVColumn[] { SomeCol, SomeCol2, ...}; private void ObjectListView_CellEditFinishing(object sender, CellEditEventArgs e) { if (cbColumns.Contains(e.Column)) ... but ObjectListView_CellEditStarting is the problematic. I guess in CellEditStarting I will have to discriminate each case separately: private void ObjectListView_CellEditStarting(object sender, CellEditEventArgs e) { if (e.Column == SomeCol) // code to create the combo, put the correct list as the datasource, etc. else if (e.Column == SomeOtherCol) // code to create the combo, put the correct list as the datasource, etc. And so on. But how can I parameterize the "code to create the combo, put the correct list as the datasource, etc."? Problem lines are (1) Get SomeObject. the property NAME varies. (2) Set ISomeOtherObject, the property name varies too. The types vary too, but I can cover those cases with a generic method combined with a not so "typesafe" API (for instance, the cb.DataBindings.Add and cb.DataSource both use an object) Reflection? more lambdas? Any ideas? Any other way to do the same? PS: I want to be able to do something like this: private void ObjectListView_CellEditStarting(object sender, CellEditEventArgs e) { if (e.Column == SomeCol) SetUpCombo<ISomeInterface>(ISomeOtherObjectCollection, "propertyName", SomeObject, ISomeOtherObject); else if (e.Column == SomeOtherCol) SetUpCombo<ISomeInterface2>(ISomeOtherObject2Collection, "propertyName2", SomeObject2 ISomeOtherObject2); and so on. Or something like that. I know, parameters SomeObject and ISomeOtherObject are not real parameters per see, but you get the idea of what I want. I want not to repeat the same code skeleton again and again and again. One solution would be "preprocessor generics" like C's DEFINE, but I don't thing c# has something like that. So, does anyone have some alternate ideas to solve this?

    Read the article

  • How do I prevent flickering on CListCtrl?

    - by Sorin Sbarnea
    I'm using a CListCtrl/CListView report view (LVS_REPORT) in virtual mode (LVS_OWNERDATA) with LVS_EX_DOUBLEBUFFER enabled and I encounter ugly flickering. Double buffer have a real effect but it doesn't stop all flickering (without it very slow). I'm not looking for switching to other controls that would require a high amount of rework (like ObjectListView) How does the flickering behaves: * on column resize - the background is first clean using lightgray and after this is displayed the text (background is white) * on mouse scroll (animated) - for a very short time there is lightgray-bar displayed in the area where new lines are to be displayed. It looks like it does clean the background using the default window background color (lightgray) for the area where it has to redraw. How do I solve the flickering problem?

    Read the article

  • Alternative way of implementation of a code

    - by vikramjb
    The title is not exactly meaningful, but I am not share what else to name it. I wrote a TOC Generation code sometime later. Based on this I was writing code to check for duplicates also. The code is as follows curNumber = getTOCReference(selItem.SNo, IsParent); CheckForDuplicates(curNumber, IsParent,out realTOCRef); curNumber = realTOCRef; And the code for CheckForDuplicates is ListViewItem curItem = this.tlvItems.FindItemWithText(curNumber); if (curItem != null) { curNumber = this.getTOCReference(curNumber, !IsParent); CheckForDuplicates(curNumber, IsParent,out realTOCRef); } else { realTOCRef= curNumber; } What this code does, it gets a TOC and tries it find if it already exists in the ObjectListView and gets a new TOC if there is a existing TOC. Once it determines that the generated TOC is not there in the list it stores it in realTOCRef and sends it back to the main calling code. I have used "out" to return the last generated TOC, which is something I did not want to do. The reason why I did it was after the non duplicate TOC was generated the return was not going back to the calling code instead it looped through the previous instances then it returned back. When the looping back happened the TOC that was to be returned also got reset. I would appreciate any help on this.

    Read the article

1