FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to create Browser window? (and other questions)

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.     Forum Index -> DWT
View previous topic :: View next topic  
Author Message
lijie



Joined: 28 Oct 2005
Posts: 24
Location: Shenzhen, China

PostPosted: Fri Nov 04, 2005 8:00 am    Post subject: How to create Browser window? (and other questions) Reply with quote

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
View user's profile Send private message
lijie



Joined: 28 Oct 2005
Posts: 24
Location: Shenzhen, China

PostPosted: Fri Nov 04, 2005 9:27 am    Post subject: Reply with quote

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
View user's profile Send private message
lijie



Joined: 28 Oct 2005
Posts: 24
Location: Shenzhen, China

PostPosted: Sat Nov 05, 2005 8:16 am    Post subject: Reply with quote

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
View user's profile Send private message
lijie



Joined: 28 Oct 2005
Posts: 24
Location: Shenzhen, China

PostPosted: Sun Nov 06, 2005 2:21 am    Post subject: Reply with quote

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
View user's profile Send private message
Shawn Liu



Joined: 09 Mar 2005
Posts: 104
Location: Shanghai, China

PostPosted: Mon Nov 07, 2005 9:05 am    Post subject: Reply with quote

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
View user's profile Send private message
Shawn Liu



Joined: 09 Mar 2005
Posts: 104
Location: Shanghai, China

PostPosted: Sun Nov 13, 2005 12:45 pm    Post subject: Reply with quote

Hi, lijie:
I noticed that your location is Shenzhen, China. And my place is Shanghai, China. Hehe, nice to meet you here. Very Happy
But it seem that this forum can't not support Chinese characters at all.

- Shawn
Back to top
View user's profile Send private message
zwang



Joined: 14 Sep 2005
Posts: 5
Location: Singapore

PostPosted: Sun Nov 13, 2005 10:08 pm    Post subject: Reply with quote

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. Very Happy
But it seem that this forum can't not support Chinese characters at all.

- Shawn



可以显示汉字的 Smile
Back to top
View user's profile Send private message
Shawn Liu



Joined: 09 Mar 2005
Posts: 104
Location: Shanghai, China

PostPosted: Mon Nov 14, 2005 4:18 am    Post subject: Reply with quote

Wow, really.
We can leave private message in Chinese.
Here let's post in English. Laughing
Back to top
View user's profile Send private message
lijie



Joined: 28 Oct 2005
Posts: 24
Location: Shenzhen, China

PostPosted: Tue Nov 15, 2005 7:23 am    Post subject: Reply with quote

Aha. Nice to meet you.

But, sorry for my poor English...
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.     Forum Index -> DWT All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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