View previous topic :: View next topic |
Author |
Message |
lijie
Joined: 28 Oct 2005 Posts: 24 Location: Shenzhen, China
|
Posted: Tue Nov 01, 2005 10:24 pm Post subject: How to write SWT program? |
|
|
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 |
|
|
kris
Joined: 27 Mar 2004 Posts: 1494 Location: South Pacific
|
Posted: Tue Nov 01, 2005 10:30 pm Post subject: |
|
|
Mango.swt is not part of the official download at this point. In other words, it does not work yet
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 |
|
|
lijie
Joined: 28 Oct 2005 Posts: 24 Location: Shenzhen, China
|
Posted: Tue Nov 01, 2005 11:05 pm Post subject: |
|
|
Thanks. Kris.
Is the goal of Mango to become JSP or ASP of D language? |
|
Back to top |
|
|
kris
Joined: 27 Mar 2004 Posts: 1494 Location: South Pacific
|
Posted: Wed Nov 02, 2005 2:19 am Post subject: |
|
|
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
Historically, Mango started as an IO package to support a high-performance web-server, since Phobos IO wasn't sufficiently capable. |
|
Back to top |
|
|
lijie
Joined: 28 Oct 2005 Posts: 24 Location: Shenzhen, China
|
Posted: Wed Nov 02, 2005 6:30 am Post subject: |
|
|
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 |
|
|
sean
Joined: 24 Jun 2004 Posts: 609 Location: Bay Area, CA
|
Posted: Wed Nov 02, 2005 10:15 am Post subject: |
|
|
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 |
|
|
kris
Joined: 27 Mar 2004 Posts: 1494 Location: South Pacific
|
Posted: Wed Nov 02, 2005 1:32 pm Post subject: |
|
|
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 |
|
|
sean
Joined: 24 Jun 2004 Posts: 609 Location: Bay Area, CA
|
Posted: Wed Nov 02, 2005 1:44 pm Post subject: |
|
|
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 |
|
|
lijie
Joined: 28 Oct 2005 Posts: 24 Location: Shenzhen, China
|
Posted: Wed Nov 02, 2005 8:45 pm Post subject: |
|
|
I think that is what I need. |
|
Back to top |
|
|
|