I have an app with a menu. When Item 1 is Selected, UserControl1 is displayed.
The issue is that UserControl1 is full of 3rd party components and takes about 4 seconds to load. I would like to display a BusyIndicator so the user doesn't think that nothing is happening.
The issue is that even though I have a toolkit: BusyIndicator and set it to busy, it doesn't show until after UserControl1 loads. This of course defeats the purpose of the BusyIndicator.
Since the load of the control is on the UI thread, the BusyIndicator never has a chance to fire up until it is too late.
I need to somehow fire off the BusyIndicator, let the UI update, then fire off the load of the Control. Then turn off the BI.
This was resolved by the use of a timer.
Related
start menu's item can be executed single-click,
explorer's item can be executed double-click or right-click and (O)pen.
like this, Windows UI is many execution method.
I want to know execution through UI(like item double-click).
How to know that?
I try to use UI Automation. but focus change is Too late and sometimes executed without focus change.
so I want certain method.
The assumption.
UI to kernel execution message.
Can I get it?
And other method is exist?
I have a CListCtrl in my MFC application. The list needs to be updated when I get some notification from the server. Updating list works quite good when there are less notification as operations on the list are less. But in case of heavy load, list control and in turn the application gets freeze.
I am aware of updating UI items in the separate thread in case of bulk updates, but in this case I have the notifications that can come in any order and in any volume, I need to handle in such way that my main thread is not getting blocked.
If anyone faced the issue before please suggest the approach for this case.
You could put all the updates into a queue. Then do a limited number of updates from the queue to the control in the OnIdle function. OnIdle is called when your GUI message queue is empty. It could do up to, say, 20 updates and then return. The main thread would than process any GUI input and when finished with that it would call OnIdle again. In this way you delay and spread out the updates while keeping the GUI alive.
I had a similar situation and resolved it using a Timer. Only when the Timer ticked the ListCtrl could got updated.
Side note: You should do
SetRedraw(FALSE);
before a bulk update
and
SetRedraw(TRUE);
after.
You should not have the control drawing itself at a one-by-one item level, when doing a bulk operation.
Use Thread.I had the same problem and I solved it by just having the loop of adding elements into the clistctrl in thread function. That is,is the POSTMESSAGE() function in the thread should be called as much time as we want to add elements .
MFC Application getting stuck when adding list control elements
Also refer the above link to get some idea
So I've got my little beginning of an app loading data from json into a CardScrollView. Sometimes this takes a few seconds, so I need a loading screen. Normally I'd do this with the progress action bar or a progress bar spinning around. I found a question around this:
https://stackoverflow.com/questions/20237873/google-glass-gdk-progress-indicator
So far so good, however I can't determine how to construct a layout for my activity so I see the progress loading and then when data load is finished, the card scroll view. What I'm doing now is first I set the loading view in the onCreate:
setContentView(mLoadingView)
Then later once the loader is finished I call:
mCardScrollView.activate()
setContentView(mCardScrollView)
Not only does this feel hackish, but it doesn't handle the case of reloading data. Normally I'd do this in android with a frame layout xml which would have the progress bar and list view in it and then toggle progress bar visibility / progress. But I'm not sure how to do this in glass. Maybe I'm not even following the right "glass paradigm". Any ideas?
Currently in the GDK sneak peek, you'll have to roll your own solution like you've already done. But you can track the feature request for a Glass-style progress here here on our issue tracker.
I have a QT application that allows a user to define a list of models. Each model defined has a fairly complex widget class that is created. Currently this is all being done in the main (GUI) thread. The program works fine for normal use, but I tried to stress test it by creating 200 to 1000 models and the creation of the GUI took a VERY long time (20 seconds to many minutes).
I tried a couple attempts at threading out the work using QtConcurrent::run, but the program always complained because "Widgets must be created in the GUI thread."
I found this answer on SO: How do I create a Window in different QT threads?. But this doesn't seem to be doing much in the new thread except telling the main thread to create a new widget. This does not distribute the workload, as far as I can tell.
With all of that, I have a couple direct questions:
1) Is there a better design (faster performance) than looping through my list of models and serially creating each widget?
2) If this process is possible to be multithreaded, can someone point me in the direction of a simple example?
There really is no way to put widget stuff to other threads. OpenGL rendering or some data processing for a widget to show when ready, stuff like that can easily use other thread, but not the actual widgets.
Better design would be to create the widget when you need it. Or just have one widget and update the data it displays (unless widgets for different items are actually different).
If you are worried about performance when scrolling, then one solution to that is to switch widget only after current one has been visible for some minimum time (say, 500ms if user keeps scrolling, or 200ms after last scroll event, some logic like that) note that this is not delay for reacting to user selection, this is delay after selection and visible widget change, so if user just changes to next item, GUI is updated immediately. But in scrolling the widget is not updated for every item briefly selected, and things don't slow down. Use QTimer or two to send signal when widget should be updated.
I have an ember.js application. It shows a list of "Problems". Once loaded, the first action taken to select (click) an individual item from this list has a 1-2 second delay. No delay is ever present on subsequent clicks.
The delay is not from the server, if I remove all content from the view/template, the delay is still present.
The delay is not in rendering. If I instrument the rendering process (as described in this answer: https://stackoverflow.com/a/15129150/1167846) nothing happens with rendering at all during that time, and the list displayed at the end shows nothing that indicates a multi-second pause.
If I use console.log all over the place, the click event appears to make all the necessary changes in my code (selecting the item as "current") without any delay.
How do I figure out where this delay is coming from?