Unterschiede
Hier werden die Unterschiede zwischen der gewählten und der aktuellen Version gezeigt.
| swt-jface:table-selection 2008/07/02 13:26 | swt-jface:table-selection 2020/01/22 20:59 aktuell | ||
|---|---|---|---|
| Zeile 1: | Zeile 1: | ||
| ====== Table, Auswahl ändern ====== | ====== Table, Auswahl ändern ====== | ||
| + | //org.eclipse.swt.widgets.Table//\\ | ||
| + | //org.eclipse.jface.viewers.TableViewer//\\ | ||
| <code java> | <code java> | ||
| - | myTable.setSelection(indx); | + | Table myTable = ... |
| + | myTable.setSelection(indx); // Scrollt im Bedarfsfall | ||
| + | // myTable.select(indx); // Scrollt nicht | ||
| myTable.setFocus(); // Ohne diese Zeile wird die Selection nicht erkannt?! | myTable.setFocus(); // Ohne diese Zeile wird die Selection nicht erkannt?! | ||
| </code> | </code> | ||
| + | \\ | ||
| + | <html> | ||
| + | <script type="text/javascript"><!-- | ||
| + | google_ad_client="pub-9681858985507948"; | ||
| + | google_ad_width = 468; | ||
| + | google_ad_height = 60; | ||
| + | google_ad_format = "468x60_as"; | ||
| + | google_ad_type = "text"; | ||
| + | google_ad_channel = ""; | ||
| + | google_color_border = "cccccc"; | ||
| + | google_color_bg = "FFFFFF"; | ||
| + | google_color_link = "1d2d8c"; | ||
| + | google_color_text = "000000"; | ||
| + | google_color_url = "1d2d8c"; | ||
| + | //--> | ||
| + | </script> | ||
| + | <script type="text/javascript" | ||
| + | src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> | ||
| + | </script> | ||
| + | </html> | ||
| + | \\ | ||
| + | \\ | ||
| oder:\\ | oder:\\ | ||
| <code java> | <code java> | ||
| + | Table myTable = ... | ||
| ISelection selection = new StructuredSelection(myTable.getItem(indx).getData()); | ISelection selection = new StructuredSelection(myTable.getItem(indx).getData()); | ||
| myTable.getViewer().setSelection(selection); | myTable.getViewer().setSelection(selection); | ||
| myTable.setFocus(); // Ohne diese Zeile wird die Selection nicht erkannt?! | myTable.setFocus(); // Ohne diese Zeile wird die Selection nicht erkannt?! | ||
| + | </code> | ||
| + | Die Selektion einer Tabelle kann man mit folgendem Code erfragen:\\ | ||
| + | <code java> | ||
| + | table.addSelectionListener (new SelectionAdapter() { | ||
| + | public void widgetSelected (SelectionEvent e) { | ||
| + | int[] selections = table.getSelectionIndices (); | ||
| + | } | ||
| + | } | ||
| </code> | </code> | ||