If the ListView is not visible, does refresh code execute? - vb.net

I am using Visual Basic.net and have a question: If I have a piece of code, such as refreshing a ListView, and the form that the ListView is on is not currently visible, does this code execute? I am just wondering if it is a waste of memory to execute this code, or if it is not executed at all.

If you're firing a timer, and that timer is executing code that refreshes the display of the list view, it will execute, but the display will not refresh until you ... actually display it to the user.
In other words, the ListView's state gets updated with the changes, but the changes aren't displayed until the form is visible. No video card pixels are harmed in the updating of the hidden ListView, in other words.

Refreshing listview doesn't harm/waste memory unless the data(Listview items) are too many. If your code contains retrival of listview items for some other controls or dynamic manipulations based on data/items from the listview then refreshing listview is needed.

Related

Titanium editing textField in a listView

I have a listView that has a textField in the item template. To make sure that the listView saves the data I have used the code from this link it works in that it saves the data to the listView item but it looses focus every time the onChange event fires the updateItemAt method so the keyboard disappears after every key press.
I have tried onBlur but I then get the original text flashing up before it is replaced with the new text from the blur event.
Is there a way to stop loosing focus when the updateItemAt listView method is fired?
No, there is not, because by updateItemAt you are re-rendering that row.
Also, its not a best practice to store data in proxy objects. Better store the data in the data collection that drives your listview or a separate object/array.

Dgrid change page show busy or standby indicator

I have dgrid with paging, 50 rows per page, and using a memory store
The last 2 columns are editable select and filtering select, so when I change page it takes some time.
The problem is that there is not indication to the user that something is happening.
No loading message or a spinning image.
So I want to know if there is an event that fires up before the change of page, so I can manually show a spinner.
So far I have not been able to find such an event.
I used firebug to listen to all click that fires up when I click on the grid, and clicked on the next button to see what will happen.
The only event that fired up was after the rendering of the page. Before the rendering I got nothing.
So how can I show a busy indicator to user when I change page on the dgrid?
A div with the class dgrid-loading is added to the content area of the grid when Pagination loads a new page, and that div spans the full width and height of the content area. You can add styles to this class to add a loading indicator.
You can also add a loading message via the grid's loadingMessage property.
There's an explanation and demonstration of the loading node in the Grids and Stores tutorial in the Customizing Messages section.

Scroll automatically to a control inside scrollviewer

I have a scrollviewer in page which shows data vertically, and it contains controls like grid, stackpanel and listbox.
Listbox contains items with expanderview. On click of expander view header it expands, I just want that whenever it expands its content get visible in page. Means i have to automatically change scroll position and make visible a Listbox selected control.
Is there any way?
There is a way to manage it Programatically with use of Timer. When the timer is triggerd, we call the timer_Tick event handler, which scrolls to the current index and marks it as selected, and then updates the index. After the last item is highlighted the index is reset to the first item. You can find useful sample here Auto-scrolling ListBox for Windows Phone
You need to calculate the offset where you want to scroll to, and then use ScrollToVerticalOffset(your_offset_value) method.
Have a look over here : How to use ScrollViewer.ScrollToVerticalOffset?

Button in UserControl in main page not reacting to pointer in Windows Store apps

To share a common display layout in a Split template Windows Store app, I put a Back button, title TextBlock, and another button in a UserControl, and then use that control in most of my pages. My problem is that in the main page, neither of the buttons will react to pointer activity, be it pointer over or clicking. However, it works fine in any other page. To isolate it, I created a blank app and duplicated the UserControl, but it works in that case.
How can I debug this?
Thanks.
-John
In an "ItemView" page of a "Split" template app, the Grid containing the back button and title must be below the GridView and ListView in the XAML code. Apparently the GridView, with no Grid.Row, and a Grid.RowSpan="2" needs to overlay the first and second rows, and if the button is beneath the GridView, it must assume it is not visible and doesn't need to respond to events. I moved my new user control instance to below the GridView, and the buttons work now.
This whole scheme of overlaying both rows makes no sense to me, but without the Grid.RowSpan="2", the items don't split nicely into two rows for me. I think such odd layout should have a comment explaining it in the template. Perhaps it could save someone else from this same kind of issue.

Update image on button VB.net

I’m trying to make a button that displays an image, that’s easy, but the image is an editable icon so I want the image on the button to be updated every time the form is started how can this be done?
I am making the assumption that you are using WinForms and saving your editied icon to a file.
Take a look at this MSDN page on ButtonBase.Image Property.
From above link:
button1.Image = Image.FromFile("C:\Graphics\MyBitmap.bmp")
You can put this in the New Subroutine after the InitializeComponent Statement. or in your Form Load event.
Use Graphics method and also handle the Paint event of Button. You can add text and primitive drawing on Image or Button region.