I'm using the QTableView class to display a table from a database. I want to allow the user to edit the table using the keyboard only.
However, the default behavior of the class is to reset the focus to the starting index of the table after 2 edits, ie. I edit a cell, press the "Down" key, edit the cell, again press the "Down" key, at which point the table loses focus; next time I press the down key, the first cell of the table gains focus.
What methods of the class should I look at to modify this behavior?
I'm using the single item selection mode:
self.entryView = QTableView()
self.entryView.setModel(self.logModel)
self.entryView.setItemDelegate(LogDelegate(self))
self.entryView.setSelectionMode(QTableView.SingleSelection)
self.entryView.setSelectionBehavior(QTableView.SelectItems)
I used TreeWidget before so they should be similar. How about explicitly specifying the "active item" by calling setCurrentItem() method after modification? in this way you can always have the correct focus
Related
Is it possible to create a code that allows a button to hide specific cells (e.g. (B10:B15) + C17 + C19 + (D10:D18)) when pressed and then have the reappear when pressed again? Alternatively another button for the reapearing can be accepted.
You cannot hide a single cell. But if you want to hide/unhide e.g. a number of columns using a shortcut key you can do as follows:
In the View toolbar, click Macros, then Record Macro....
Enter a key, under shortcut key (Ctrl + ...). [Let's assume you put 'h'] Then press OK.
Hide the columns you want to hide (or anything you want to happen by pressing the shortcut key).
Goto View toolbar, click Macros, then Stop Recording.
Now when you press the defined shortcut key (e.g. Ctrl+h), the desired columns will hide.
You can follow the same steps to define a different shortcut key for unhiding.
If you want to make some single cells (kind of) invisible, you can do that by changing the font color to match the background color. Again you can use the same steps mentioned above to create a shortcut key for that.
I want to fix the order of the cursor when the user presses 'tab' to go in order. Not sure where the order is, i've tried moving around everything in the VBA
Each object on the Userform has a TabIndex property, adjust the numbering for each object to adjust the order.
RowEditEnded does not fire when edit inline on Grid that only has one row.
If Grid has more than one row, when I edit inline a row, I can click on another row and this event will fire. In this event, I will implement saving function.
But if Grid has only one row, I click to the empty space below but Grid still know I select the old row and this event does not fire.
(Hit Enter always affect, but some users don't know this way)
How to fix this issue?
Thanks.
Telerik reply : user should press the Enter key or the Tab key to the end of the editable cells on the same row.
http://www.telerik.com/forums/roweditended-does-not-fire-when-edit-inline-on-grid-that-only-has-one-row#9XFK1ifa1kSvUUjH-rWa6w
In the relational controls sample db (xpagesjdbc.nsf) there is an example called JDBC_RowSetDatasource. This uses a view panel and has the check box turned on in the view panel to allow the user to select a document. Then there is a button to delete the selected docs using a simple action, delete selected documents. This deletes the document but until the button with the code that has jdbcData1.acceptChanges() is pressed the changes are not committed and the row shows as to be deleted (first icon column with the isRowDeleted() call to determine the icon).
I am working on a similar situation but with a repeat control. I can delete the row with #jdbcDelete but that is immediate. Looking at the data it shows the row is gone from the data even before acceptChanges() is called.
Since I can't use the simple action to delete selected documents (no view panel) what is the Java equivalent to delete the row in a similar manner? I have tried deleteRow() on both the variable for the data set and for the row but get an error in both cases.
Howard, the simple action just memorizes the primary keys of the records as to be deleted. If you want to simulate that you need to take a similar approach (using a ViewScope variable or bean) to keep track of your "deleted" records and a method that executes the actual deletion.
Smells like a case for a bean
First off I am new to FM but I have a good handle on the basics. What I need to do is this - in a contact information type layout I want to be able to alter the layout based on a specific field. Ex. When the record is brought up, the background of the layout will change colors for a client, another for vendor, etc.
I tried to change a label based on a field, with no success. My guess is that the layout is static and only the data fields change.
We use FM Pro.
Thanks,
Mark
FileMaker layouts are static, but there are still some things you can do to alter the layout based on the values of fields:
Calculation Fields
If you want the data shown in an area to change, you can use a Calculation field. A typical example of this would be a status field. To do this you would add a new field to your table and use enter a calculation on that field like:
Case (
IsEmpty(myTable::myField) ; "Please enter a value for myField." ;
myTable::myField = "wrong value" ; "Please enter a correct value for myField." ;
"Everything seems okay."
)
Conditional Formatting
To make things like background color change you can use a conditionally formatted field. I will typically add an empty numeric field (for this example we'll call it emptyField) and set it so that it can't be edited during modification.
If you place emptyField on your layout, below all the other fields and disallow the user to enter the field in either Browse or Find mode, you can then use conditional formatting to change the field's color.
Portal Hiding
You can use this technique when you want some elements of your UI to disappear when they aren't needed. For example, if you want a "submit" button to appear only when all of the records on a field are filled out.
To use this technique I will usually create a Calculated number field, called ReadyForSubmit, on the original table and give it a logical calculation like:
not IsEmpty(field1) and ... and not IsEmpty(fieldN)
(Note that the value of the above function would be 1 or 0)
I will then create a new Support table in my database and add to it a field One with a calculated value set to 1.
I will then make a relationship between myTable::readyForSubmit and Support::One.
On the layout, create a portal with one row. Put your Submit button in that layout. Now, when readyForSubmit calculates to 1 the button will appear. When it calculates to 0 the button will be hidden.
Hidden Tab Browser
Finally, you can use a tab browser where you set the title font size to 1 point, hide the border, and control the browser programmatically. You can use this for having different field arrangements for different types of records. To do this you would first give an Object name to each tab of the tab browser, say Tab1, Tab2, Tab3.
Then you would add a script, goToTab, with the logic for when you want to go to each tab. Say:
If (myTable::myField = "corn")
Go to Object (Tab1)
Else If (myTable::myField = "squash")
Go To Object (Tab2)
End If
You would then use Script Triggers to run goToTab when On Record Load.
With the release of filemaker 13 there may be another way to do this. You could use a slide control, name the panels in the control, and conditionally switch to the correct panel based on the record type.
you would drop the appropriate fields for the record type in each panel.
http://help.filemaker.com/app/answers/detail/a_id/12012/~/using-slide-controls-and-slide-panels-in-filemaker-pro