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

The "hello DWT" is done !

 
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
Shawn Liu



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

PostPosted: Thu Mar 31, 2005 7:21 am    Post subject: The "hello DWT" is done ! Reply with quote

Laughing Rolling Eyes Laughing Rolling Eyes
Based on the existed achievement of the DWT group, I have managed making the DWT workable after several weeks struggle. Here I am glad to declare, the "Hello DWT" is done! Thanks for the DWT group!

I have uploaded the source. Anyone interested can download and have a glance of the first DWT app. Thanks!

The URL is http://www.dnaic.com/d/download
5 files are available
"dide_full_995a_UNSUPPORTED.zip" is the DIDE which I used to compile the project.
"lib-dwt.rar" is the extra lib for the DWT linking.
"TheONe.exe.rar" is the executable file of "Hello DWT".
"TheOne.rar" is the currently source code.
"TheOneV1.rar" is the old source code with less modules but more bugs.


The skeleton of an application is available. The display, shell, control, widget modules are almost finished though buggy. No other widget has been ported except Button for the reason short of time. Events and Listeners are commented for temporary. We may need other approach instead of Listener/Adapter/Event. It seems that D doesn't support anonymous class, I think the mechanism in Java is not suitable for D.

Only ANSI version is available. Don't set any version identifier when compile.
"lib-dwt.rar" need to be extracted to \dmd\lib or \dm\lib or any where else DMD can find.
"TheOne.rar" must be extracted to "C:\d\TheOne" since DIDE use absoluted path to manage the files. Or it won't work.


Last edited by Shawn Liu on Thu Mar 31, 2005 10:57 am; edited 2 times in total
Back to top
View user's profile Send private message
Shawn Liu



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

PostPosted: Thu Mar 31, 2005 8:29 am    Post subject: Reply with quote

1) SWT supports all windows platform in a single app. They use OS.IsUnicode, OS.IsWinCE to distinguish platforms. Codes not suitable for current platform are compiled and linked. And a judge "if(OS.IsUnicode)" before every call to Win32 API. I think this is not effective for performance and size. Say nothing of library or declare missing for WinCE or PocketPC when compiling in desktop environment. And more, seldom people still use win95/98 nowadays.

For the performance,size and simplification reason, the DWT may use version(Unicode) version(WinCE) directly to allow the suitable codes and libraries to be included for appropriate platform.

2) Functions in OS module are renamed with a "os" prefixed. This is the way to wrap Unicode and Anis API together. And introduce D types directly into OS module. And avoid the name conflict with other modules. For example, the Win32 API Rectangle(HDC, int, int, int, int) and the dwt.graphics.rectangle, the Win32 API RGB(BYTE, BYTE, BYTE) and the dwt.graphics.rgb and etc. Another reason is to provide debug convenience by assert(HWND) or other error catch. just in OS module and once, but not every time you call OS functions.

3) String processing may be the most headache when porting. Java or C# type "char" is 2 bytes and faces Unicode directly, while build in string type in D is "char" (single byte). The runtime library of D facing char[] directly. e.g. Object.toString() return char[], Exception(char[]) and etc. Any class derived from Object has the toString() method and return char[], not overridable

We have no choice but char[] as the string type for DWT. Just My own opinion and implementation.

to be continued ...
Back to top
View user's profile Send private message
JJR



Joined: 22 Feb 2004
Posts: 1104

PostPosted: Thu Mar 31, 2005 11:58 am    Post subject: Reply with quote

Once again, excellent work, Shawn. Smile

This project will act as a base for others. The next step is to suitably track SWT releases for bug fixes. That can be taken care of by other project initiatives that might automate the process. For now, your success can act as a platform for understanding how to make the SWT mechanism work with D. I'm sure there's more troubleshooting to do. Every bit of experience in fixing them helps further the cause. Smile

Unfortunately, I can be of no help here. My only computer is currently unusable, eventually to be taken in for repairs. So I'm left stranded at this momentous time, idly watching everybody succeeding in their coding projects with no way to contribute to or test the results (currently borrowing my brother's computer when I can)... I'll eventually get back into all this when my laptop is fixed up again.

Once again, thanks for your contributions. Great to see all that hard work pay off.

All the best,

John
Back to top
View user's profile Send private message
brad
Site Admin


Joined: 22 Feb 2004
Posts: 490
Location: Atlanta, GA USA

PostPosted: Thu Mar 31, 2005 2:38 pm    Post subject: Reply with quote

Shawn,

Do you want write access to the DWT repository? As John said, there may be another project that will automate the process of converting SWT to D, but until that effort has some success, you could check your code into DWT and people could give it a test drive... Let me know if that's what you want.

BA
Back to top
View user's profile Send private message
Shawn Liu



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

PostPosted: Thu Mar 31, 2005 6:55 pm    Post subject: Reply with quote

brad wrote:
Shawn,

Do you want write access to the DWT repository? As John said, there may be another project that will automate the process of converting SWT to D, but until that effort has some success, you could check your code into DWT and people could give it a test drive... Let me know if that's what you want.

BA


Yes, please. Thanks, Brad!
I'd like to be a member of the DWT develop group and push the project forward.
Back to top
View user's profile Send private message
Shawn Liu



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

PostPosted: Thu Mar 31, 2005 7:25 pm    Post subject: Reply with quote

JJR wrote:
Once again, excellent work, Shawn. Smile

This project will act as a base for others. The next step is to suitably track SWT releases for bug fixes. That can be taken care of by other project initiatives that might automate the process. For now, your success can act as a platform for understanding how to make the SWT mechanism work with D. I'm sure there's more troubleshooting to do. Every bit of experience in fixing them helps further the cause. Smile

John

Thanks, John. For the help to me and the contribute to the project.
You are a rigth. This is just a small step forward and there's more troubleshooting to do. Currently, the most important thing is to determine an approach to implement the Listener/Adapter/Event mechanism of SWT. All event processing in my code are commented currently. They will not be ported before we have the best choice or tradeoff. This is just to avoid repeated coding, since event is tied tightly with almost every control. Do you have any decision about it. We may continue the discuss here http://www.dsource.org/forums/viewtopic.php?t=54

Hope you have your laptop repaired soon and back to project to work together.

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



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

PostPosted: Mon Apr 04, 2005 10:18 am    Post subject: status Reply with quote

I am currently porting the rest widgets in widgets directory. And thinking about integrate the D delegate into listener/adapter/event mechanism. This is not so easy by replace the listener with delegates. e.g.. a button may has a OnClick event,
Code:
Button btn = new Button();
btn.OnClick ~= &btnClick;

int btnClick(Event e){
  //...
}
This is not enough, since SWT provide the removeListener method when sometime we want to disable or cancel the listening capability of a widget.
And I am a little busy with my job these days. The porting may last for a long period.
Back to top
View user's profile Send private message
JJR



Joined: 22 Feb 2004
Posts: 1104

PostPosted: Mon Apr 04, 2005 1:25 pm    Post subject: Reply with quote

No problem, Shawn. You've done tremendously well despite the challenges. The delegate verses listener idea was something we had to consider before too. I think what we decided was that it was better to stick with SWT's listener system than to attempt to convert everything to delegates. This would allow us to at least get DWT "off the ground."

Delegates are a great idea for vastly simplifying the DWT event system, but they come at the cost of huge design changes to SWT. This translates to more troubleshooting and more bugs. So it's probably safest to not worry about delegates at this point.

Don't worry about it if you need to take a break. You've done plenty so far. Thank you for all you contributed to this point.

All the best,

JJR
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