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

How to write SWT program?

 
Post new topic   Reply to topic     Forum Index -> Mango
View previous topic :: View next topic  
Author Message
lijie



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

PostPosted: Tue Nov 01, 2005 10:24 pm    Post subject: How to write SWT program? Reply with quote

I have looked for some SWT source codes of java edition, some of them seem to be like this:
Quote:
newButton = new Button(shell, SWT.NONE);
newButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
clearText();
setTextEditable(true);
enableEditButtons(false);
enableSaveButtons(true);

System.out.println("New button selected.");
}
});
newButton.setBounds(10, 380, 75, 35);
newButton.setText("New");

How to convert it to mango.swt?

Thanks.
Back to top
View user's profile Send private message
kris



Joined: 27 Mar 2004
Posts: 1494
Location: South Pacific

PostPosted: Tue Nov 01, 2005 10:30 pm    Post subject: Reply with quote

Mango.swt is not part of the official download at this point. In other words, it does not work yet Smile

You'll find a working version of SWT in the DWT project (also at dsource.org). As far as converting from Java goes ~ Walter recently added support for true inner classes to DMD, so that one could write code like your example. I don't know if DWT takes advantage of that though.
Back to top
View user's profile Send private message
lijie



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

PostPosted: Tue Nov 01, 2005 11:05 pm    Post subject: Reply with quote

Thanks. Kris.

Is the goal of Mango to become JSP or ASP of D language?
Back to top
View user's profile Send private message
kris



Joined: 27 Mar 2004
Posts: 1494
Location: South Pacific

PostPosted: Wed Nov 02, 2005 2:19 am    Post subject: Reply with quote

lijie wrote:
Thanks. Kris.

Is the goal of Mango to become JSP or ASP of D language?

Pragma is working on something like that, in his DSP project (currently using the Mango servlet engine). Mango itself is intended to be nothing more that some useful libraries for development ~ primarily designed for, but not limited to, systems software.

On the other hand, Mango.io is a good (and fast) OO replacement for the upper layers of Phobos; the Ares project replaces the Phobos lower levels. If you add just Mango.io to Ares, you still end up with a solid OO platform for D development (and don't need to link Phobos anymore). Then, add more Mango packages as desired Smile

Historically, Mango started as an IO package to support a high-performance web-server, since Phobos IO wasn't sufficiently capable.
Back to top
View user's profile Send private message
lijie



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

PostPosted: Wed Nov 02, 2005 6:30 am    Post subject: Reply with quote

Thank the information that you offer.

I have looked over all projects, but has not found a suitable C/S framework for me, like ACE(C++), and can choose select, poll, epoll, complection ports.

If mango also plans to expand , can consider some to this?
Back to top
View user's profile Send private message
sean



Joined: 24 Jun 2004
Posts: 609
Location: Bay Area, CA

PostPosted: Wed Nov 02, 2005 10:15 am    Post subject: Reply with quote

Is there really a need to manually choose between the IO mode? I would think that the library should be able to automatically select the most efficient method for the purpose. On Win32, IOCP might be used if multithreading were enabled and asynch callbacks if not. select might be the compatibility mode, etc.
Back to top
View user's profile Send private message
kris



Joined: 27 Mar 2004
Posts: 1494
Location: South Pacific

PostPosted: Wed Nov 02, 2005 1:32 pm    Post subject: Reply with quote

I've been tempted to at least add support for overlapped IO within Mango.io, and enable some kind of abstraction level.

Also been thinking about adding an IO event dispatcher, to support event-based designs. The latter would certainly help simplify code targeted for multi-core CPUs ... I think this would address some of your questions, and perhaps some of Seans too?
Back to top
View user's profile Send private message
sean



Joined: 24 Jun 2004
Posts: 609
Location: Bay Area, CA

PostPosted: Wed Nov 02, 2005 1:44 pm    Post subject: Reply with quote

I think it would. This is how I've always done socket IO in the past, and it allows the IO mode to be separated fairly cleanly from user code.
Back to top
View user's profile Send private message
lijie



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

PostPosted: Wed Nov 02, 2005 8:45 pm    Post subject: Reply with quote

I think that is what I need.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> Mango 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