I'm using a TableViewer and I want to it perform like when I hold CTRL key. I mean if I click a row, it must be added to selection and not replace current selection.
I probably need to do this manually in selection listener. But may be there's a better (more convinient) way?
Tableviewer wraps a Table, which multi-select behavior is platform-specific, that means you cannot disable that. If you want to implement your own multi-select behavior you have to implement your own table-widget which does not depend on the Table widget from SWT. The Composite Table should be a good starting point...
How about adding the SWT.CHECK attribute when constructing the table so the table entries will be selected with a checkbox?
Related
Is it possible to use the built in triangle button to filter records for datasheet form in continuous forms?
If not. Then do you think if it is possible to code such a feature?
Also, is it possible to add a select all button within the datasheet form itself instead of placing it in a form containing the datasheet as a subform?
I’m afraid I have no choice but to use continuous forms because of how limiting datasheet forms are.
No, this is not an available feature. Also, no workarounds are available.
You can add an image with the filter icon and try to determine if the column is filtered, but that's both very difficult and not very useful (since you can't get the dialog to adjust the filter when you click on it).
If you want the filter dialog, however, you can just right click one of the fields to add a filter or adjust an existing filter.
I'm trying to create a filter so the user can choose any of 40+ fields to display in a query result that has been dynamically created via VBA.
This is something I see standard in a lot of programs so I figure someone must have code that does it without me reinventing the wheel. Unfortunately I haven't been able to find it online.
Basically when it starts all the field names are listed in the left box and the right box is empty. The user can click a right arrow button to move the fields into the right box or a left arrow to remove them and put them back in the left box. Also the user can use up and down arrow buttons to change the order of a selected field in the right listbox.
Once I have the right listbox populated and ordered correctly I know how to execute the query properly.
If you are unable to find a full example for this then you'll need to work through it step-by-step yourself. Here is an MSDN link for the ListBox control. There are links to the various methods and properties of this control at the bottom of the page.
Essentially, clicking a button (your arrow(s)) triggers the Click event;
In this event you might need to loop through to find the Selected item;
If the listbox is multi-select then you can examine the ItemsSelected collection;
Then you would use the AddItem and RemoveItem methods to move them for right-to-left or left-to-right.
I cannot recall currently whether the Field List option is bound to the table, or whether it just populates the list once when the form is loaded. If it is bound then you would instead need to use the Value List option and use VBA to retrieve all the field-names, and use these to set the RowSource (you may be doing this already).
In either event (Field or Value List) I don't believe the lists can remain sorted automatically (unlike in VB.NET). You will probably need to split the RowSource up into a (dynamic) array, find a simple sort routine to sort the array, and reassign the sorted items as the RowSource.
An alternative would be to create two temporary tables and use ADO (or DAO) to insert and delete rows between them, then use SELECT statements each time to re-populate the lists. This has the advantage that the SELECT can include an ORDER BY clause to sort the lists each time. However, It perhaps involves a little bit more effort (to maintain, and delete, the temporary tables).
You might, however, want to continue your search as I suspect an example is out there somewhere. Good luck.
I am currently implementing drag and drop using the DataGrid provided in the Silverlight SDK and I want the user to be, easily, able to drag multiple items to another list.
The grid's selection gets updated on the MouseDown event so the only way the user have to drag multiple items is to press Shift while begining the drag operation. This is not really obvious and, for me, the natural way whould have been to just click the selected block of rows and drag them. To do so, the selection needs to be updated on the MouseUp event.
I've tried to derive from the DataGrid to inject my custom DataGridRows but the DataGrid doesn't expose a way to replace the type of rows it creates.
Anyone have a solution or ideas for this?
Thank you,
Jacques.
Yes, it's unfortunate that the selection is updated on mousedown. You will need to perform some work in the mousedown event to work around this. This codeproject article should help:
http://www.codeproject.com/Tips/338594/Drag-drop-multiple-selected-rows-of-datagridview-w
In order to support automated testing tools I need to x:Name all controls (so that the tool can "pick it up" and observe its details).
The question is concerning DataGrid where the ItemSoure is bound to a property (in the ViewModel).
What is the best way to ensure all rows and all grid cells are uniquely named?
A better question is: If a DataGrid is x:Named, will automated test tools be able to observe its rows and individual cells, even if the rows/cells are NOT x:Named themselves?
Option 1 (which id like to avoid) is the x:Name each row (on the row loading event, as well as all of its column cells).
Is there perhaps another option where all of these are x:named (uniquely) automatically?
Even better, perhaps all this is not even needed.
In case anybody is interested, i found the answer. Listen for the Row-loaded event. From there recursively traverse down the rows layout/control tree while naming valid controls (while ignoring any layout controls... Grid, StackPanel, Border).
in a windows form if i want to duplicate the properties window layout on my form, which is basically a 2 column table with title on the left and value on the right, what control do i use to achieve that?
A DataGridView component can be used to achieve a similar visual style and functionality, though it is not exactly the same.
To add columns, click the Smart Tag and change the settings, click "edit columns", and you know the rest.
If you want the exact same functionality as the properties window, and let your users edit the properties of an object, you can use the Properties control.