How can I wrap the text in a ListBox? - vb.net

I am populating a ListBox with the current function:
Public Function fillListBox5(theList As List(Of FARG_Data))
For Each item In theList
ListBox5.Items.Add(item.getFargFunction)
Next
End Function
This works well, but some of the item's FargFunctions are decently long causing portions of the string to be cut off at the end of the ListBox. Is there anyway I can make the text wrap so that none of it is cut off?

Set the ListBox.HorizontalScrollbar property to True. This can either be done within the designer or programmatically:
ListBox5.HorizontalScrollbar = True
This will give the user the ability to scroll and view all the text:

Or you can set the css style overflow: auto;
select {
overflow: auto;
}

Related

Qml button fix size

I have made list whose delegate is RowLayout consist of Button. The list takes data from cpp.
My problem is the button variable width. The button side changed based on data. I want to keep fix button side and wrap text
To give your Button a fixed width, just set the property with the same name to a fixed value.
The Button has a contentItem that is a Text. You can change the wrapMode there to Text.WordWrap
As the contentItem is of type Item you can't set the wrapMode like this:
Button {
width: 100
text: 'Very very long button description.'
contentItem.wrapMode: Text.WordWrap // Won't work
}
Instead you might use Component.onCompleted like this:
Button {
width: 100
text: 'Very very long button description.'
Component.onCompleted: contentItem.wrapMode = Text.WordWrap
}

DataTables how to cut string and add (...) and put the full string in tooltip

I use fine DataTables for my website.
In a few rows it can happens that the string is very very long (e.g. 500 to 1000 chars).
How to cut that at 20 signs, add "..." and put that in a tooltip?
(of course I know substring and know how to add a tooltip, I just want to know if there is a feature / option for me on datatables or on which event I can get the data and cut it and add a tooltip to the cell)
I know that the question is already answered, but i would like to add this
datatable plugin as an option for this exactly problem. There's a very good explanation of how it works and how to use it in this blog post.
It's very simple to use, suppose that you need the text to get cut and only show 20 characters, you can use like this:
$("#yourTableSelector").dataTable({
... // other configurations
columnDefs: [{
targets: 0, // the target for this configuration, 0 it's the first column
render: $.fn.dataTable.render.ellipsis(20)
}]
});
Just to clarify, this plugins requires DataTables 1.10+
I don't know of a pure DataTables solution but this can be achieved by a setting fixed column width (via CSS or DataTables options) combined with text-overflow: ellipsis on your table cells.
For text-overflow to work you also need to specify a fixed width, set overflow: hidden and white-space: nowrap:
.limited{
white-space: nowrap;
width: 100%;
overflow: hidden;
text-overflow: ellipsis;
}
To see the full cell content add it to the cell's title attribute:
<td class='limited'
title='Very long cell content which is to long for the cell but shown as a tooltip'>
Very long cell content which is to long for the cell but shown as a tooltip
</td>
Which could look something like this:
See the MDN article on text-overflow for more details.
Another option would be using DataTables orthogonal data feature. In contrast to just using substring to limit the cell content, this would allow you to keep the complete cell content searchable:
<td data-search='Very long cell content which is to long for the cell but shown as a tooltip'
title='Very long cell content which is to long for the cell but shown as a tooltip'>
Very long cell content...
</td>
The output would be the same es above.

How do I change listview item size programmatically of winjs listview?

I have template binded with the listview in windows store application which I am developing using html5 and javascript. I have a requirement to change the size of the listview item programmatically. Basically I have a input type range on my page. User will change the value of the input and according to that value I should be able to change the size of the listview item programmatically.
Any help or pointer will be much appreciated.
Thanks in advance!
I know this is old, but I have just spent hours doing extensive tests (because I didn't feel like switching to grid mode) and I found a very simple way that would allow you to have items of any height without them overlapping,I though I would share it, all you need to do is add this to your css:
.win-listview .win-listlayout .win-container {
height:auto;
}
You can set the size of the items in a listview using the class set on the item in the template. You can:
Define different classes for the different sizes you want
Define the sizes in CSS. Example:
.small {
height: 150px;
width: 150px;
}
.large {
height: 300px;
width: 300px;
}
Set the appropriate class on the template item:
var templateItem = document.querySelector("#regularListIconTextTemplate .regularListIconTextItem");
WinJS.Utilities.addClass(templateItem, "large");
Refresh the listview:
element.querySelector("#listView").winControl.forceLayout();

removing the scroll bars and borders from the web browser object

I have a powerpoint that is using a web browser object. The trouble is that the scrollbars on the web browser object are always there, regardless of whether or not they are needed. Is there some way to remove the scroll bars?
I have tried adding:
WebBrowser.Document.body.Scroll = "no"
but that makes the object stop working all together.
Also, the object has a thin light colored (i think it is white but it is hard to tell) border around it. Since most of my presentation is black this does not blend well though i have set the background color of the html displayed to be black. Is there a way to get rid of the border as well?
if they cannot be done with vba can they be done at all?
My understanding is no, this is not possible. I dislike the scroll bar, but it's a part of IE and I don't see any way to remove it without completely disabling functionality as you have already seen.
JimmyPena,
I did it. After some tests I discovered that if I set the image to webbrowser and try to set other Document.Body properties in the same "f5" execution it didn't work.
If you try to use "f8", it works, ironically.
I think it is because that webbrowser component cannot set some properties after loading an object.
Sooooo, i tried to make an HTML file in which my object (in my case, an gif image) was set and all properties was set as well, including scroll removal, margin removal and border removal.
You can see my codes below.
HTML (test.html):
<html>
<head>
</head>
<body style="overflow: hidden; margin: 0; border: 0;">
<img src="Assets/loading-small.gif" />
</body>
</html>
VBA:
Sub abaSV_showLoadingIcon()
AbaSV.WebBrowser1.Visible = True
AbaSV.WebBrowser1.Navigate ThisWorkbook.path & "\test.html"
End Sub
I think that should help you, JimmyPena and uncertaintea.
SeeYa!
Your idea works just fine, except for the VBA part.
So what I did is to creat a html file as you did, assigning the properties and calling the gif image.
Then in VBA i used the following code (in the sheet where the webborser can be found):
Private Sub worksheet_activate()
WebBrowser1.Navigate "insert html file path.html"
End Sub
I solved this by applying in the html file this code under the <head> tag:
<style type="text/css">
html {
overflow:hidden;
}
</style>
Use Document.Body.Scroll = "No" to disable scroll bar in Webbrowser
Option Explicit
Private Sub
UserForm_Activate()
WebBrowser1.Navigate "C:-Download-P.gif"
End Sub
Private Sub
WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
With WebBrowser1
. Width = 80
. Height = 80
. Document.Body.Scroll = "No"
End With
End Sub

VB.NET: Change Background Opacity

I have a VB.NET form with a red background and white text. I want to change the opacity of the background (not the text) to 50%; how would I go about accomplishing that?
Use the Form.Opacity property.
Snippet from MSDN link:
Dim instance As Form
Dim value As Double
value = instance.Opacity
instance.Opacity = value