Bug 6852 - StyledText - verify event character invalid value
Summary: StyledText - verify event character invalid value
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 2.0   Edit
Hardware: PC Linux-Motif
: P3 normal (vote)
Target Milestone: 2.0 M2   Edit
Assignee: Grant Gayed CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 1699
  Show dependency tree
 
Reported: 2001-12-12 11:34 EST by Veronika Irvine CLA
Modified: 2002-01-11 16:42 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Veronika Irvine CLA 2001-12-12 11:34:18 EST
20011211

Run the following wad of code and hit CTRL Space in the StyledText widget.
On Windows, you get the "Here" message, on Linux motif you do not.
I have found that the value event.character is 0x20 on Windows but -1 on Linux 
motif.

Since this value is just being copied from the KeyDown event, it is probably 
not an error in StyledText but above that.

public static void main (String [] args) {
	Display display = new Display ();
	Shell shell = new Shell (display);
	
	StyledText text = new StyledText(shell, SWT.BORDER);
	text.setBounds(10, 10, 400, 400);
	text.addVerifyKeyListener(new VerifyKeyListener() {
	   public void verifyKey(VerifyEvent event) {
			//do code assist for CTRL-SPACE
           if (event.stateMask == SWT.CTRL && event.keyCode == 0) {
                if (event.character == 0x20) {
                    System.out.println("Here");
                    event.doit = false;
               }
           }
	   }
	});
	
	shell.open ();
	while (!shell.isDisposed ()) {
		if (!display.readAndDispatch ()) display.sleep ();
	}
	display.dispose ();
}
Comment 1 Grant Gayed CLA 2002-01-11 16:06:52 EST
Fixed.  Workaround was needed for bug in XLookupString: it performs a lookup on 
CTRL-space, answers a result length of 1 (good), but does not fill the provided 
character buffer with anything (bad).  We now handle this case.