[英]Suppress default double-click event in SWT.CHECK Table
我正在使用SWT.CHECK
和SWT.FULL_SELECTION
樣式的SWT表。 當用戶雙擊表行時,我添加了MouseListener來填充輸出組。 但是,雙擊也會切換該行的復選框。 盡管我認為這是目標平台(Windows)的預期行為,但我想防止復選框切換。
是否可以不雙擊復選框?
我發現,我正在使用的Table實現添加了一個SelectionListener來切換復選框。
當我刪除它時,一切都按預期工作:
Listener[] listeners = table.getListeners(SWT.Selection);
if (listeners.length > 0) {
TypedListener typedListener = (TypedListener)listeners[0];
SelectionListener selectionListener = (SelectionListener)typedListener.getEventListener();
table.removeSelectionListener(selectionListener);
}
這不是一個干凈的解決方案,但是由於我知道該對象當時只有一個SelectionListener,因此以這種方式刪除它似乎是合法的。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.