Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Help,About the combo's style-- read_only
Help,About the combo's style-- read_only [message #452391] Sat, 19 March 2005 07:41 Go to next message
Eclipse UserFriend
Originally posted by: wang_w_t.126.com

when the style of combo is SWT.READ_ONLY
and the combo focus out an exception(says after the code) occurs
but if removed SWT.READ_ONLY,everything is ok,except couldn't read only.
/*
* Created on 2005-3-16
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
package org.eclipse.swt.snippets;

import org.eclipse.swt.*;
import org.eclipse.swt.widgets.*;
import org.eclipse.swt.layout.*;
import org.eclipse.swt.custom.*;
import org.eclipse.swt.graphics.*;

/**
* @author wwt
*
* TODO To change the template for this generated type comment go to
Window -
* Preferences - Java - Code Style - Code Templates
*/
public class newCellEditor {
public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell(display);
shell.setLayout(new FillLayout());
final Table table = new Table(shell, SWT.BORDER | SWT.MULTI);
table.setLinesVisible(true);
for (int i = 0; i < 2; i++) {
TableColumn column = new TableColumn(table, SWT.NONE);
column.setWidth(100);
}
TableItem itemHead = new TableItem(table, SWT.NONE);
itemHead.setText(new String[] { "property", "value" });

TableItem item1 = new TableItem(table, 0);
item1.setText(new String[] { "SerialNum", "0" });

TableItem item2 = new TableItem(table, 0);
item2.setText(new String[] { "Name", "UnName" });

TableItem item3 = new TableItem(table, SWT.SHADOW_OUT);
item3.setText(new String[] { "Age", "0" });

TableItem item4 = new TableItem(table, 0);
item4.setText(new String[] { "Address", "Local" });

final TableEditor editor = new TableEditor(table);
editor.horizontalAlignment = SWT.LEFT;
editor.grabHorizontal = true;

table.addListener(SWT.MouseDown, new Listener() {
public void handleEvent(Event event) {
Rectangle clientArea = table.getClientArea();
Point pt = new Point(event.x, event.y);
int index = table.getTopIndex();
while (index < table.getItemCount()) {
boolean visible = false;
final TableItem item = table.getItem(index);

for (int i = 1; i < table.getColumnCount(); i++) {
Rectangle rect = item.getBounds(i);

if (rect.contains(pt)) {
final int column = i;
if (item.getText(0).equals("Address")) {
final Combo comboAddr = new Combo(

table,SWT.DROP_DOWN|SWT.READ_ONLY);///here
comboAddr.setItems(new String[] {
"Local","Home","Office","Campus"});
comboAddr.setBounds(rect);
int addrIndex=
comboAddr.indexOf(item.getText(i));
if (addrIndex==-1)
comboAddr.select(0);
else
comboAddr.select(addrIndex);
Listener comboListener = new Listener(){

public void handleEvent(Event e) {
switch(e.type){
case SWT.FocusOut :
item.setText(column,
comboAddr.getText());
comboAddr.dispose();
break;
case SWT.Traverse :
switch(e.detail){
case SWT.TRAVERSE_RETURN :
item.setText(

column,comboAddr.getText());
case SWT.TRAVERSE_ESCAPE :
comboAddr.dispose();
e.doit = false;
}
break;
}
}
};

comboAddr.addListener(SWT.FocusOut,comboListener);

comboAddr.addListener(SWT.Traverse,comboListener);
editor.setEditor(comboAddr,item,i);
return;
} else {
final Text text = new Text(table, SWT.NONE);
Listener textListener = new Listener() {
public void handleEvent(final Event e) {
switch (e.type) {
case SWT.FocusOut:
item
.setText(column, text
.getText());
text.dispose();
break;
case SWT.Traverse:
switch (e.detail) {
case SWT.TRAVERSE_RETURN:
item.setText(column, text
.getText());
//FALL THROUGH
case SWT.TRAVERSE_ESCAPE:
text.dispose();
e.doit = false;
}
break;
}
}
};
text.addListener(SWT.FocusOut,
textListener);
text.addListener(SWT.Traverse,
textListener);
editor.setEditor(text, item, i);
text.setText(item.getText(i));
text.selectAll();
text.setFocus();
return;
}
}

if (!visible && rect.intersects(clientArea)) {
visible = true;
}

}
if (!visible)
return;
index++;
}
}
});
shell.pack();
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
display.dispose();
}

}

//end




An unexpected exception has been detected in native code outside the VM.
Unexpected Signal : EXCEPTION_ACCESS_VIOLATION occurred at PC=0x77DFAD42
Function=GetWindowLongW+0x2BA
Library=C:\WINNT\system32\USER32.dll

Current Java thread:
at org.eclipse.swt.internal.win32.OS.CallWindowProcW(Native Method)
at org.eclipse.swt.internal.win32.OS.CallWindowProc(OS.java:139 7)
at org.eclipse.swt.widgets.Combo.callWindowProc(Combo.java:254)
at org.eclipse.swt.widgets.Control.windowProc(Control.java:3050 )
at org.eclipse.swt.widgets.Combo.windowProc(Combo.java:1499)
at org.eclipse.swt.widgets.Display.windowProc(Display.java:3338 )
at org.eclipse.swt.internal.win32.OS.SetFocus(Native Method)
at org.eclipse.swt.widgets.Table.sendMouseDownEvent(Table.java: 1967)
at org.eclipse.swt.widgets.Table.WM_LBUTTONDOWN(Table.java:2909 )
at org.eclipse.swt.widgets.Control.windowProc(Control.java:3001 )
at org.eclipse.swt.widgets.Display.windowProc(Display.java:3338 )
at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:14 73)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :2429)
at org.eclipse.swt.snippets.newCellEditor.main(newCellEditor.ja va:152)

Dynamic libraries:
0x00400000 - 0x00406000 C:\Program Files\Java\j2re1.4.1\bin\javaw.exe
0x77F80000 - 0x77FFD000 C:\WINNT\system32\ntdll.dll
0x796D0000 - 0x79732000 C:\WINNT\system32\ADVAPI32.dll
0x77E60000 - 0x77F32000 C:\WINNT\system32\KERNEL32.DLL
0x786F0000 - 0x78761000 C:\WINNT\system32\RPCRT4.DLL
0x77DF0000 - 0x77E4F000 C:\WINNT\system32\USER32.dll
0x77F40000 - 0x77F7B000 C:\WINNT\system32\GDI32.dll
0x78000000 - 0x78045000 C:\WINNT\system32\MSVCRT.dll
0x75E00000 - 0x75E1A000 C:\WINNT\system32\IMM32.DLL
0x6C330000 - 0x6C338000 C:\WINNT\system32\LPK.DLL
0x65D20000 - 0x65D74000 C:\WINNT\system32\USP10.dll
0x6D330000 - 0x6D45C000 C:\Program Files\Java\j2re1.4.1\bin\client\jvm.dll
0x77530000 - 0x77560000 C:\WINNT\system32\WINMM.dll
0x6D1D0000 - 0x6D1D7000 C:\Program Files\Java\j2re1.4.1\bin\hpi.dll
0x6D300000 - 0x6D30D000 C:\Program Files\Java\j2re1.4.1\bin\verify.dll
0x6D210000 - 0x6D229000 C:\Program Files\Java\j2re1.4.1\bin\java.dll
0x6D320000 - 0x6D32D000 C:\Program Files\Java\j2re1.4.1\bin\zip.dll
0x10000000 - 0x1004E000
F:\software\eclipse\eclipse\plugins\org.eclipse.swt.win32_3. 0.1\os\win32\x86
\swt-win32-3063.dll
0x77A30000 - 0x77B1F000 C:\WINNT\system32\ole32.dll
0x71710000 - 0x71794000 C:\WINNT\system32\COMCTL32.dll
0x76AF0000 - 0x76B2E000 C:\WINNT\system32\comdlg32.dll
0x70A70000 - 0x70AD6000 C:\WINNT\system32\SHLWAPI.DLL
0x78F90000 - 0x791D5000 C:\WINNT\system32\SHELL32.DLL
0x77990000 - 0x77A2B000 C:\WINNT\system32\OLEAUT32.dll
0x60000000 - 0x6004B000 C:\WINNT\system32\MSCTF.dll
0x777E0000 - 0x777E7000 C:\WINNT\system32\version.dll
0x75950000 - 0x75956000 C:\WINNT\system32\LZ32.DLL
0x0B410000 - 0x0B413000 C:\WINNT\mui\fallback\0804\msctf.dll.mui
0x77900000 - 0x77923000 C:\WINNT\system32\imagehlp.dll
0x72960000 - 0x7298D000 C:\WINNT\system32\DBGHELP.dll
0x687E0000 - 0x687EB000 C:\WINNT\system32\PSAPI.DLL

Local Time = Sat Mar 19 15:23:42 2005
Elapsed Time = 6
#
# The exception above was detected in native code outside the VM
#
# Java VM: Java HotSpot(TM) Client VM (1.4.1-b21 mixed mode)
#
# An error report file has been saved as hs_err_pid1880.log.
# Please refer to the file for further information.
#
Re: Help,About the combo's style-- read_only [message #452397 is a reply to message #452391] Sat, 19 March 2005 13:06 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: wang_w_t.126.com

i change Combo to CCombo ,then it's ok
but why?
thanks for all

"Wentao Wang" <wang_w_t@126.com> д
Re: Help,About the combo's style-- read_only [message #452499 is a reply to message #452397] Mon, 21 March 2005 16:02 Go to previous message
Grant Gayed is currently offline Grant GayedFriend
Messages: 2150
Registered: July 2009
Senior Member
This is a bug, so I've logged
https://bugs.eclipse.org/bugs/show_bug.cgi?id=88646 . I tried to add you to
the report as a CC but bugzilla did not know of your email address.

Grant

"Wentao Wang" <wang_w_t@126.com> wrote in message
news:d1h72v$uu5$1@www.eclipse.org...
> i change Combo to CCombo ,then it's ok
> but why?
> thanks for all
>
> "Wentao Wang" <wang_w_t@126.com> д
Previous Topic:Controlling border in a table cell
Next Topic:History and Browser Widget
Goto Forum:
  


Current Time: Thu Mar 28 19:50:42 GMT 2024

Powered by FUDForum. Page generated in 0.03242 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top