I am using ObjectListView instead of the standard ListView is because I wanted to word-wrap the columns.
I read in several places that the only thing I need to to in order to enable word-wrapping is the set column.wordWrap to true.
I did just that, but it doesn't work.
What am I missing here?
Edit:
I realise now that I need to make my column owner drawn.
I found this page which sort of tells me what to do, but I'm not sure where to place it in my code. I'm also not quite sure whether I need to add certain attributes inside the delegate to allow word-wrapping (by the looks opf things it's enabled by default). The thing is, I tried what I found in this page, copied it word for word, and my list looks exactly the same...
If you mean by "word wrapping", you want different rows to have different heights, the FAQ answer is correct -- it simply can't be done.
However, if you make each row so that it can display two or more lines of text, then, yes, ObjectListView can word wrap.
It needs three conditions:
Set WordWrap to true on the column to wrap. You've already done that.
Make sure the ObjectListView is owner drawn (set OwnerDraw to true -- this can be done in the Form Designer). The base ListView can't word wrap, so we have to draw the cells ourself.
Make sure there is room to see the wrapped lines by setting the RowHeight to 32 (or some other value)
This is the data tab from the demo. The first column has WordWrap set to true.
On the ObjectListView SourceForge FAQ page, it explicitly states:
Can it word-wrap?
No.
Related
i try to use TextMatchFilter for my ObjectListView.
I do not know why, but instead of Filterung (what i want), the function only highlights the words.
So i want the whole ObjectListView to show only the Rows where the Filter is true.
This is my Code:
this.fastoLV_Clean.ModelFilter = TextMatchFilter.Contains(this.fastoLV_Clean, "Test");
fastoLV_Clean.Refresh();
Does anyone know, what i have to do to really Show only the rows and not to only highlight the ones in which it was found?
Regards and thank you,
You need to set the UseFiltering property of your ObjectListView to be True
If you don't set this, then it will just highlight your text. When set, then it will filter and only show the relevant rows.
BTW: You don't need to call fastoLV_Clean.Refresh()
A Refresh is normally only needed in some cases, such as when you change the columns programmatically. It is not needed for simple things such as this when you model data is updated. (I noticed this also in your other post, but forgot to mention it!)
I'm using ObjectListView and I'm trying to wrap the text in a column.
I have 2 columns and have set the WordWrap property of the second column to true. It doesn't appear to work.
In the image below the last line should wrap
I have searched SO and tried all the suggestions including setting OwnerDraw to true but nothing helps.
Any ideas?
"Owner draw" means: I (the control) will not draw anything, I will assume that you (the control consumer) will do it all for me.
That is a general statement, I know nothing of this specific control. It seems to me that the WordWrap feature is not implemented. So you either have to implement the feature in the control itself or use OwnerDraw which means doing it all yourself.
Updated
By the way, I encounter this need myself quite often. I don't bother with ListView or 3rd party controls, I simply use a DataGridView and make it look and behave like a ListView. It can do wrapping text columns.
According to this answer, your ObjectListView must be "OwnerDrawn".
how can a visibility of a particular column can set to false in a listview..that is the column should exists in the client site but in hidden form...
what is the option other than setting the width to 0.
im working in c#.net VS2008
Use ObjectListView. This was specifically designed with the idea of getting away from hidden columns to hold data.
With an ObjectListView, each row knows which model object was used to construct it. So, if you want to find the FilePath for the object that the user has selected you say:
MyDataModel model = this.objectListView.SelectedModel as MyDataModel;
if (model != null) {
DoSomething(model.FilePath);
}
Also, you might want to look at this other question which talks about the same problem from a higher point of view.
ObjectListView also adds lots of nice UI candy, which always impresses the users :)
(source: sourceforge.net)
BTW: ObjectListView is Windows Forms only.
You shall have to set the width of the column to ZERO in this case.
In Winform's MonthCalendar control I am getting a weird white border on the top and bottom of the calendar when I don't want to show the today label.
Is there anyway to disable this?
I think I see this too. The size of the calendar is calculated by a private method named GetMinReqRect(). It returns a size too large when ShowToday is off. The comment this method has in the Reference Source is:
Used internally to get the minimum size needed to display the MonthCalendar. This is needed because NativeMethods.MCM_GETMINREQRECT returns an incorrect value if showToday is set to false.
Looks to me somebody in the Windows group fixed the bug and forgot to the tell the WF group about it. Unsurprising, the WF group is very hard to find.
I don't see an obvious workaround, the method is private. SetBoundsCore() applies the size, there is no way to bypass it. You can post the bug to connect.microsoft.com but you'll get the "post to a forum to get help" brush-off.
If I make a Statusbar, and PackEnd a Label to it, it looks something like this:
The Shadow disappears over the Label, but remains over the rest of the Statusbar. I want to remove the Shadow from the entire Statusbar. The PyGTK documentation mentions a property called shadow-type, but it's readonly, and nowhere to be found in GTK#. How do I get rid of this shadow?
You're not supposed to pack stuff into the statusbar, it's not meant as a general container.
To display text in a status bar, use its own API, i.e. gtk_statusbar_push() from C. The GTK# docs on go-mono.com seem to be offline, so I couldn't link to those right now.
shadow-type is a style property, which means it's actually supposed to be set by the user and/or desktop theme. You can set it by writing a custom style file for your application and reading it in using gtk.RcStyle.
If you have a need for two separate status messages in your application, you could also consider packing two status bars into an hbox.
The first child of a GtkStatusbar is a GtkFrame which gives the shadow border (edit: apparently not). You should be able to do this:
statusbar.get_children()[0].set_shadow_type(gtk.SHADOW_NONE)
Several apps (most notably Epiphany and, in the past, Galeon) actually replace the contents of that frame with an HBox so they can add stuff to the statusbar.