How to get the content in the table within a CVirtualGridCtrl control of a window through pywinauto - ui-automation

I am trying to get the content of a table within a GridCtrl control as shown in the screenshot below.
I have found through spy++ that the control containing the table is CVirtualGridCtrl.
But how can I get the content of the table?
app = pywinauto.Application().Connect(path = "xiadan.exe")
control = app[u'网上股票交易系统5.0'].CVirtualGridCtrl
control.PrintControlIdentifiers()
If I run the above code, I will get the following output:
Having searched and test for a long time, I still have no clue.
Could someone kindly give me a hint? Thanks a lot.
Edit:
Really appreciate your quick response #vasily-ryabov. I have tried as you suggested, unfortunately there is no recognizable control to get the numbers I want.
Does this mean that it is then impossible to get the content of the cells?
I have also tried right clicked on the control, but there is no interested short-cut operation.

You can try to use clipboard to get grid data.
control.type_keys('^A^C')
data = pywinauto.clipboard.GetData()

Related

copy/paste row with event 1 row down and create new event on top of former row with event. The events themselves are text

I hope you will be able to help me.
I need to do the following in Excel:
a. Newest event comes on top and the former event moves 1 row down (below), and;
b. After newest event has been copied and pasted to 1 row down, the first row is clear of any data (blank cells);
c. Now a new event comes on top of the former event. If there is also a new date involved than everything the old events and dates moves at least 2 rows down and leaves a blank row in between. And so on until a full month has been reached;
d. After that the entire sheet/month is copied to an archive.
I've been trying to write the code for this in VBA, but thus far it's not working. To be honest, I can't code and I've trying to do this through youtube and everything I can find online.
I would greatly appreciate any help I can get on this one. I'm new here so I can't a picture just yet. Hopefully somebody understands my questions.
Again thanks for any help on this one.
enter image description here
The picture describes pretty much how I want this to work
I'm answering my own questions, because I sort figured it out and I'm really excited. So the code is not perfect, I know but it works :)
There are two type of code running:
1.
Sub MoveCopyRows()
'Copy and Paste Row
Range("10:10").Copy
Range("11:11").Insert
End Sub
And
2.
Sub CutInsertSheet()
'Cut or Copy and Paste to another worksheet
Worksheets("Overdracht").Range("11:35").Cut
Worksheets("Berichtenhistorie").Range("6:6").Insert
Application.CutCopyMode = False
End Sub
This coding has got me hooked. Now I'm going to see, if I can combine them and if I would be able to change the cell color automatically after adding a new row. Wish me luck everybody! :) And before I forget, thx everybody for your help!

How do you display boolean values in a cell of React-Data-Grid?

Pretty simple issue, I'd like to display boolean values in my react-data-grid. I honestly don't care how it's displayed: Checkbox, Radio, text... I just want it to appear so I can edit it.
I'd rather not convert my data to all strings, then have to reconvert them back but that may be the only way.
This is a related issue that was just simply closed: https://github.com/adazzle/react-data-grid/issues/722
There's also a similar question: Using CheckboxEditor with react-data-grid asked yesterday and completely silent.
Does anyone have any way to show and edit boolean values in React-Data-Grid, or should I be looking elsewhere.
Since it's Boolean you can have a dropddown. I don't have a demo to show, but you can get the idea of what to do by looking at the following example.
Link.
There see the logic behind "Issue Type" Column.

QCompleter and Tab key

I'm trying to make a Completion when pressing tab, you get the first completion of all possibilities.
But, in a QWidget-based main window, pressing tab will make that QLineEdit lost focus, and completion popup hides after that.
Is there a way to fix it ?
Have you tried to subclass QLineEdit and intercept the key press event?
Alternatively you could set up an event filter.
Whew. It took me some time to figure this out :) Multiple times I have tried to solve this problem, but always gave up. Now, I dug enough to find the answer.
OP, please pardon me, because the code here is Python, but should be understandable and work for C++ as well.
Basically, the problem I had was "how to select an entry in the QCompleter"; I didn't notice before, but the answer is in the popup() method. QCompleter works with a model and a view, which contains the things to show.
You can change the current row as you wish, then get the index of that row in the model, then select it in the pop-up.
In my code, I subclassed QLineEdit, created a tabPressed signal which is emitted every time Tab is pressed. Then, connected this signal to a method of the same class which does this:
get the current index;
select the index in the popup;
advance to the next row.
As implementation, this is very trivial, but for my current purpose this is enough. Here's the skeleton (just for the tab part, it's missing the model and everything else).
class MyLineEdit(QLineEdit):
tabPressed = pyqtSignal()
def __init__(self, parent=None):
super().__init__(parent)
self._compl = QCompleter()
self.tabPressed.connect(self.next_completion)
def next_completion(self):
index = self._compl.currentIndex()
self._compl.popup().setCurrentIndex(index)
start = self._compl.currentRow()
if not self._compl.setCurrentRow(start + 1):
self._compl.setCurrentRow(0)
def event(self, event):
if event.type() == QEvent.KeyPress and event.key() == Qt.Key_Tab:
self.tabPressed.emit()
return True
return super().event(event)
You may need to adjust/fix few things, but this is the basic idea.
EDIT:
For details see
http://www.qtcentre.org/threads/23518-How-to-change-completion-rule-of-QCompleter
There's a little issue: when Return is pressed, the things don't work properly. Maybe you can find a solution to this problem in the link above, or in the referenced resources therein. I'll fix this in the next few days and update this answer.
There is probably a better solution but one that comes to mind is to change the focus policy for all other widgets on the form to something that doesn't include "tab" focus. The only options that don't use the tab key are Qt::ClickFocus and Qt::NoFocus.

UISearchbar results showing inconsistently in table view

I am using a real-time search against an external API (XML) based on what the user is entering in the search bar..
I am using a case-insensitive search. The thing was working fine, until I moved the code or rather added a thread. Suddenly the results that I get are a bit consistent. They are not incorrect, but they are sometimes lesser in number.
e.g. if a user enters "a", it will show around 7 results, say AAR, Aaron, Staar,Mtaar ...
Then if enters "aa" , it will show 1 result (AAR), then if he enters "aar", it will show 3 results AAR, Star, Mtaar
Again if backspace is pressed and if the current term in the search bar is aa, it will now show 3 results...
Another example, if I type "goog", it displays nothing in the table cell results (even though i see that it has parsed Google), while if i add an "l", i.e. if the term is now "googl", it now shows Google in the cell below.
I am updating my table view immediately after the parsing is complete.
So basically after I added thread, the search results have got a bit inconsistent. I am not sure why.
Note that in all cases the results shown are all correct, but just the no. of them is varying.
Could someone please help me with the issue.
Thanks a lot.
can you provide some sample code how you access your filtered table content array? You can NSLog() the result you get from the API and compare with the ones are displayed in your tableView.

DataGridViewComboBoxCell selectioindexchange event

I have a data-grid and three column in it. one column is type of DataGridViewComboBoxCell, three items are in this grid combo box, now i have to invoke selection index changed event to change value according to combo value change in grid.
also help me to make a new event ....
please help...
thanks
I really can't understand your question.
But maybe these informations can help:
A ComboBoxColumn has always two kinds of controls. A presenting one (in most cases a label) which is individually for each row. And a editing one that will be shared for the whole column. So take a look into this documentation and the IDataGridViewEditingControl Interface.
Maybe these will give you a starting point on how to solve your problem.
In the Load event for the form, you need to get the cell that you want to add the handler to and cast it as a regular combo box. You can then add the event handler on SelectedIndexChanged, but it must be done programmatically, and depending on the language you are using.