View previous topic :: View next topic |
Author |
Message |
lijie
Joined: 28 Oct 2005 Posts: 24 Location: Shenzhen, China
|
Posted: Fri Nov 04, 2005 8:00 am Post subject: How to create Browser window? (and other questions) |
|
|
I have built DWT with "-version=OLE_COM" option, and try to create a browser window.
I have modified examples\dummyeclipse, add some code:
Quote: |
CTabItem cTabItem7 = new CTabItem(cTabFolder_topright, SWT.NONE);
cTabItem7.setText(" FakeJava.form ");
cTabItem7.setImage(ResourceManager.getImage("FORM", GIFFILE));
CTabItem cTabItem8 = new CTabItem(cTabFolder_topright, SWT.NONE);
cTabItem8.setText(" Browser ");
cTabItem8.setImage(ResourceManager.getImage("FORM", GIFFILE));
auto browser = new Browser (cTabFolder_topright, SWT.BORDER);
cTabItem8.setControl(browser);
ScrolledComposite scrolledComposite1 = new ScrolledComposite(
cTabFolder_topright,
SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
cTabItem7.setControl(scrolledComposite1); |
Then, I built it with "-version=OLE_COM" option, and past.
But when run, it notified an error: "swt\browser\browser.d, line 289, No more handles".
This is first question (Q1).
Q2: how to set the background color of TabFolder? (or style?)
Q3: how to create a rich edit control? like code view of eclipse, not RICHEDIT control of windows.
Thanks. |
|
Back to top |
|
|
lijie
Joined: 28 Oct 2005 Posts: 24 Location: Shenzhen, China
|
Posted: Fri Nov 04, 2005 9:27 am Post subject: |
|
|
The rich edit window, I have solved.
Quote: | CTabItem cTabItem8 = new CTabItem(cTabFolder_topright, SWT.NONE);
cTabItem8.setText(" Browser ");
cTabItem8.setImage(ResourceManager.getImage("FORM", GIFFILE));
auto styledText = new StyledText (cTabFolder_topright, SWT.BORDER);
cTabItem8.setControl(styledText);
styledText.setText ("123456789 123456789 123456789 123456789 123456789");
auto ranges = new StyleRange[3];
ranges[0] = new StyleRange (3, 4, new Color (null, 255, 0, 0), new Color (null, 0, 0, 0), SWT.BOLD);
ranges[1] = new StyleRange (15, 4, new Color (null, 0, 255, 0), new Color (null, 0, 0, 0));
ranges[2] = new StyleRange (24, 4, new Color (null, 0, 0, 255), new Color (null, 0, 0, 0));
styledText.setStyleRanges (ranges); |
But "Access violation" happend, when I enter some text. |
|
Back to top |
|
|
lijie
Joined: 28 Oct 2005 Posts: 24 Location: Shenzhen, China
|
Posted: Sat Nov 05, 2005 8:16 am Post subject: |
|
|
I found some bugs when use StyledText:
1. ArrayBoundsError on startup:
swt/graphics/textlayout.d(1465): runs[count++] = item;
swt/graphics/textlayout.d(1486): runs[count++] = item;
I fixed it simply:
if (runs.length <= count)
runs.length = count + 1;
runs[count++] = item;
2. ArrayBoundsError when I enter some characters in StyledText window:
swt/string.d(1621): return opSlice()[x .. y];
I don't know where it be called. |
|
Back to top |
|
|
lijie
Joined: 28 Oct 2005 Posts: 24 Location: Shenzhen, China
|
Posted: Sun Nov 06, 2005 2:21 am Post subject: |
|
|
I think this a bug:
[swt/graphics/textlayout.d][in function "void shape (int hdc, StyleItem run)"]:
Quote: |
tempStruct.chars = segmentsText.substring(run.start, run.start + run.length).toWchar();
|
I modified to:
Quote: |
uint end = run.start+run.length;
end = end <= segmentsText.length ? end : segmentsText.length;
uint start = run.start >= 0 ? run.start : 0;
start = start < segmentsText.length ? start : segmentsText.length - 1;
if (end < start) end = start;
assert (end <= segmentsText.length);
assert (start < segmentsText.length);
if (segmentsText.length == 0)
tempStruct.chars = ""w;
else
tempStruct.chars = segmentsText.substring(start, end).toWchar();
|
Now, no errors when enter some characters in StyledText window, except the ENTER key...[/quote] |
|
Back to top |
|
|
Shawn Liu
Joined: 09 Mar 2005 Posts: 104 Location: Shanghai, China
|
Posted: Mon Nov 07, 2005 9:05 am Post subject: |
|
|
lijie wrote: |
Q1: How to create Browser window?
Q2: how to set the background color of TabFolder? (or style?)
Q3: how to create a rich edit control? like code view of eclipse, not RICHEDIT control of windows.
|
A1 : The COM_OLE version is not available yet. It is still under debugging. So the COM/OLE based components such as web browser, drag/drop, clipboard can't work currently. The Eclipse/SWT implementation of COM/OLE is clumsy and heavy due to the Java limitation of accessing native resources. I am thinking of reimplement the COM/OLE support for DWT. It may take a long time since I am not skilled at COM and OLE. Don't try to build COM_OLE version currently.
A2 : Background color/style of TabFolder can be set. Please refer to controlexample.exe and dummyeclipse.exe. The former can change the back color and font, the later draw the table with gradient Colors.
A3 : Styled-Text control is buggy. Some struct of USP (Unicode Complex Script processor) has bit fields issue, the codes need to be rewrite. see http://www.digitalmars.com/drn-bin/wwwnews?digitalmars.D/29702
I will port Scintilla to DWT as part of extra library. I think it is powerful and convenient. It comes soon.
Thanks help to improve DWT.
- Shawn |
|
Back to top |
|
|
Shawn Liu
Joined: 09 Mar 2005 Posts: 104 Location: Shanghai, China
|
Posted: Sun Nov 13, 2005 12:45 pm Post subject: |
|
|
Hi, lijie:
I noticed that your location is Shenzhen, China. And my place is Shanghai, China. Hehe, nice to meet you here.
But it seem that this forum can't not support Chinese characters at all.
- Shawn |
|
Back to top |
|
|
zwang
Joined: 14 Sep 2005 Posts: 5 Location: Singapore
|
Posted: Sun Nov 13, 2005 10:08 pm Post subject: |
|
|
Shawn Liu wrote: | Hi, lijie:
I noticed that your location is Shenzhen, China. And my place is Shanghai, China. Hehe, nice to meet you here.
But it seem that this forum can't not support Chinese characters at all.
- Shawn |
可以显示汉字的 |
|
Back to top |
|
|
Shawn Liu
Joined: 09 Mar 2005 Posts: 104 Location: Shanghai, China
|
Posted: Mon Nov 14, 2005 4:18 am Post subject: |
|
|
Wow, really.
We can leave private message in Chinese.
Here let's post in English. |
|
Back to top |
|
|
lijie
Joined: 28 Oct 2005 Posts: 24 Location: Shenzhen, China
|
Posted: Tue Nov 15, 2005 7:23 am Post subject: |
|
|
Aha. Nice to meet you.
But, sorry for my poor English... |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|