www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.dwt - Ice Breaker

reply pragma <pragma_member pathlink.com> writes:
Let me be the first (of possibly many) to say: I don't have a clue how to
program with SWT.

With that in mind, could anyone steer me toward a solid tutorial on how to
become familiarized with how SWT is organized?  How about how to do a "Hello
Windows World" application?  Tutorials?  Code comparisons to AWT or other GUI
libs?

I'd love to start talking shop in this subgroup, but I really need to do my
homework first.

Thanks,

- Eric Anderton at yahoo
Feb 07 2006
next sibling parent "Charles" <noone nowhere.com> writes:
I've only recently started using it as well.

http://www.eclipse.org/swt/snippets/

API :
http://help.eclipse.org/help31/nftopic/org.eclipse.platform.doc.isv/referenc
e/api/index.html

The DWT has a nice set of samples also under
dwt/import/current/win32/packages/examples

A bit unnerving is the lack of #swt on freenode, even #d boasts around 20
members at any given time !  #eclipse is usually full and willing to take
swt questions though.




"pragma" <pragma_member pathlink.com> wrote in message
news:dsab9v$280f$1 digitaldaemon.com...
 Let me be the first (of possibly many) to say: I don't have a clue how to
 program with SWT.

 With that in mind, could anyone steer me toward a solid tutorial on how to
 become familiarized with how SWT is organized?  How about how to do a
"Hello
 Windows World" application?  Tutorials?  Code comparisons to AWT or other
GUI
 libs?

 I'd love to start talking shop in this subgroup, but I really need to do
my
 homework first.

 Thanks,

 - Eric Anderton at yahoo
Feb 07 2006
prev sibling next sibling parent Sean Kelly <sean f4.ca> writes:
pragma wrote:
 Let me be the first (of possibly many) to say: I don't have a clue how to
 program with SWT.
 
 With that in mind, could anyone steer me toward a solid tutorial on how to
 become familiarized with how SWT is organized?  How about how to do a "Hello
 Windows World" application?  Tutorials?  Code comparisons to AWT or other GUI
 libs?
 
 I'd love to start talking shop in this subgroup, but I really need to do my
 homework first.
Aye, same here. I've some experience with Swing and MFC but that's about it in the UI realm. Sean
Feb 07 2006
prev sibling next sibling parent Deewiant <deewiant.doesnotlike.spam gmail.com> writes:
pragma wrote:
 Let me be the first (of possibly many) to say: I don't have a clue how to
 program with SWT.
 
 With that in mind, could anyone steer me toward a solid tutorial on how to
 become familiarized with how SWT is organized?  How about how to do a "Hello
 Windows World" application?  Tutorials?  Code comparisons to AWT or other GUI
 libs?
 
 I'd love to start talking shop in this subgroup, but I really need to do my
 homework first.
 
 Thanks,
 
 - Eric Anderton at yahoo
Got these from Wikipedia: An interactive Flash presentation which seems quite thorough: http://www.javalobby.org/eps/swt_intro/index.html Tutorials and examples for SWT with Eclipse: http://www.cs.umanitoba.ca/~eclipse/ Eclipse doesn't seem to feature much in the actual code examples above, so the texts should be alright from a D perspective as well. I lifted a "hello, world" from the first tutorial (on a quick browse it seems as though this is the only SWT-related code in that one, it's mostly about setting up and using Eclipse): import org.eclipse.swt.widgets.*; import org.eclipse.swt.*; public class SWTHello { public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); Label label = new Label(shell, SWT.NONE); label.setText("Hello, World!"); shell.pack(); label.pack(); shell.open(); while(!shell.isDisposed()) if(!display.readAndDispatch()) display.sleep(); display.dispose(); label.dispose(); } } The Javadoc should be able to help you with actually understanding that: http://help.eclipse.org/help31/nftopic/org.eclipse.platform.doc.isv/reference/api/index.html I can also offer an explanation of my own, based on same Javadoc, in case you or someone needs it. -- Display seems to be a "world manager" type class, taking care of everything. Even the doc says "Applications which are built with SWT will almost always require only a single display. In particular, some platforms which SWT supports will not allow more than one active display." Shell is what most people would call a window. The constructor binds it to the Display - nothing special there. Label "represents a non-selectable user interface object that displays a string or image". The constructor binds it to the Shell; the second argument is the style, whose exact effects confused me a bit since, lacking the library, I can't work with examples, only the doc. Label.setText() should be clear enough. The pack() methods resize their widgets to their "preferred size", whose definition I leave to the documentation. Shell.open() - brings the Shell to the front, makes it visible, gives it keyboard focus, asks the window manager to make it active. In layman's terms, opens the window. isDisposed() could be renamed exists(), it seems. A disposed widget is completely destroyed and is not to be used. Widgets can be destroyed by the user closing them or internally. Display.readAndDispatch() does as it is named: "Reads an event from the operating system's event queue, dispatches it appropriately, and returns true if there is potentially more work to do, or false if the caller can sleep until another event is placed on the event queue." In the program, we then sleep if the latter is the case, since we don't want to waste CPU cycles in a busy-wait. Display and Label are then disposed of. Display's dispose method comes from the Device class and "disposes of the operating system resources associated with the receiver". Label's comes from the Widget class and "disposes of the operating system resources associated with the receiver and all its descendents". -- I think that last bit is pretty interesting. Display doesn't dispose of its descendants when disposed itself, but a widget does. Personally, I think it would make most sense for it to be necessary to only dispose of Display at the end and all would be well, but no. Also, I think the orders in which some of the methods are called are a bit strange (this might be due to the example instead of how SWT works, though): - The Shell is packed before the Label. I suppose the Shell asks it descendants for their optimal sizes and calculates its own based on that, in which case the calling order doesn't matter, but it just strikes me as a bit strange. - The Display is disposed of before the Label - and the Shell isn't disposed of at all! I presume the latter is an error, because otherwise this would be very confusing. The Display doesn't dispose of its descendants - it says so right in the Javadoc. The Label is a descendant of the Shell, not the other way around, so disposing of the Label leaves the Shell completely free. Smells like a memory leak if you ask me... Phew, that was a long post! Hope this helps.
Feb 07 2006
prev sibling next sibling parent nick <nick.atamas gmail.com> writes:
pragma wrote:
 Let me be the first (of possibly many) to say: I don't have a clue how to
 program with SWT.
 
 With that in mind, could anyone steer me toward a solid tutorial on how to
 become familiarized with how SWT is organized?  How about how to do a "Hello
 Windows World" application?  Tutorials?  Code comparisons to AWT or other GUI
 libs?
 
 I'd love to start talking shop in this subgroup, but I really need to do my
 homework first.
 
 Thanks,
 
 - Eric Anderton at yahoo
http://www.java2s.com/Code/Java/SWT-JFace-Eclipse/CatalogSWT-JFace-Eclipse.htm That should get you started.
Feb 07 2006
prev sibling next sibling parent reply "Kris" <fu bar.com> writes:
http://www-128.ibm.com/developerworks/opensource/library/os-jface1/
http://www-128.ibm.com/developerworks/opensource/library/os-jface2/?ca=dgr-lnxw06SWT-JFace2

http://www-128.ibm.com/developerworks/opensource/library/os-ecgui1/
http://www-128.ibm.com/developerworks/library/os-ecgui2/

http://www.javaworld.com/javaworld/jw-04-2004/jw-0426-swtjface_p.html
http://www.javaworld.com/javaworld/jw-05-2004/jw-0531-swt_p.html

http://www.eclipse.org/articles/Article-SWT-Design-1/SWT-Design-1.html
http://www.eclipse.org/articles/Article-SWT-Color-Model/swt-color-model.htm
http://www.eclipse.org/articles/swt-design-2/swt-design-2.html
http://www.eclipse.org/articles/Article-SWT-graphics/SWT_graphics.html
http://www.eclipse.org/articles/Article-Table-viewer/table_viewer.html
http://www.eclipse.org/articles/Article-Table-viewer/table_viewer.html
http://www.eclipse.org/articles/Article-GEF-Draw2d/GEF-Draw2d.html
http://www.eclipse.org/articles/Article-small-cup-of-swt/pocket-PC.html
http://www.eclipse.org/articles/Article-Image-Viewer/Image_viewer.html
http://www.eclipse.org/articles/treeviewer-cg/TreeViewerArticle.htm
http://www.eclipse.org/articles/StyledText%201/article1.html
http://www.eclipse.org/articles/StyledText%202/article2.html
http://www.eclipse.org/articles/Article-SWT-browser-widget/browser.html
http://www.eclipse.org/articles/Article-SWT-OpenGL/opengl.html
http://www.eclipse.org/articles/Article-SWT-DND/DND-in-SWT.html
http://www.cs.umanitoba.ca/~eclipse/


"pragma" <pragma_member pathlink.com> wrote in message
news:dsab9v$280f$1 digitaldaemon.com...
 Let me be the first (of possibly many) to say: I don't have a clue how to
 program with SWT.

 With that in mind, could anyone steer me toward a solid tutorial on how to
 become familiarized with how SWT is organized?  How about how to do a
 "Hello
 Windows World" application?  Tutorials?  Code comparisons to AWT or other
 GUI
 libs?

 I'd love to start talking shop in this subgroup, but I really need to do
 my
 homework first.

 Thanks,

 - Eric Anderton at yahoo
Feb 07 2006
next sibling parent pragma <pragma_member pathlink.com> writes:
In article <dsas2c$2p3u$1 digitaldaemon.com>, Kris says...
http://www-128.ibm.com/developerworks/opensource/library/os-jface1/
http://www-128.ibm.com/developerworks/opensource/library/os-jface2/?ca=dgr-lnxw06SWT-JFace2

http://www-128.ibm.com/developerworks/opensource/library/os-ecgui1/
http://www-128.ibm.com/developerworks/library/os-ecgui2/

http://www.javaworld.com/javaworld/jw-04-2004/jw-0426-swtjface_p.html
http://www.javaworld.com/javaworld/jw-05-2004/jw-0531-swt_p.html

http://www.eclipse.org/articles/Article-SWT-Design-1/SWT-Design-1.html
http://www.eclipse.org/articles/Article-SWT-Color-Model/swt-color-model.htm
http://www.eclipse.org/articles/swt-design-2/swt-design-2.html
http://www.eclipse.org/articles/Article-SWT-graphics/SWT_graphics.html
http://www.eclipse.org/articles/Article-Table-viewer/table_viewer.html
http://www.eclipse.org/articles/Article-Table-viewer/table_viewer.html
http://www.eclipse.org/articles/Article-GEF-Draw2d/GEF-Draw2d.html
http://www.eclipse.org/articles/Article-small-cup-of-swt/pocket-PC.html
http://www.eclipse.org/articles/Article-Image-Viewer/Image_viewer.html
http://www.eclipse.org/articles/treeviewer-cg/TreeViewerArticle.htm
http://www.eclipse.org/articles/StyledText%201/article1.html
http://www.eclipse.org/articles/StyledText%202/article2.html
http://www.eclipse.org/articles/Article-SWT-browser-widget/browser.html
http://www.eclipse.org/articles/Article-SWT-OpenGL/opengl.html
http://www.eclipse.org/articles/Article-SWT-DND/DND-in-SWT.html
http://www.cs.umanitoba.ca/~eclipse/
Thanks! (Thanks to Deewiant as well) Now if you need me, I'll be here, digging myself out of this 'linkalanche'. :) - Eric Anderton at yahoo
Feb 07 2006
prev sibling parent Sean Kelly <sean f4.ca> writes:
Kris wrote:
 http://www-128.ibm.com/developerworks/opensource/library/os-jface1/
 http://www-128.ibm.com/developerworks/opensource/library/os-jface2/?ca=dgr-lnxw06SWT-JFace2
 
 http://www-128.ibm.com/developerworks/opensource/library/os-ecgui1/
 http://www-128.ibm.com/developerworks/library/os-ecgui2/
 
 http://www.javaworld.com/javaworld/jw-04-2004/jw-0426-swtjface_p.html
 http://www.javaworld.com/javaworld/jw-05-2004/jw-0531-swt_p.html
 
 http://www.eclipse.org/articles/Article-SWT-Design-1/SWT-Design-1.html
 http://www.eclipse.org/articles/Article-SWT-Color-Model/swt-color-model.htm
 http://www.eclipse.org/articles/swt-design-2/swt-design-2.html
 http://www.eclipse.org/articles/Article-SWT-graphics/SWT_graphics.html
 http://www.eclipse.org/articles/Article-Table-viewer/table_viewer.html
 http://www.eclipse.org/articles/Article-Table-viewer/table_viewer.html
 http://www.eclipse.org/articles/Article-GEF-Draw2d/GEF-Draw2d.html
 http://www.eclipse.org/articles/Article-small-cup-of-swt/pocket-PC.html
 http://www.eclipse.org/articles/Article-Image-Viewer/Image_viewer.html
 http://www.eclipse.org/articles/treeviewer-cg/TreeViewerArticle.htm
 http://www.eclipse.org/articles/StyledText%201/article1.html
 http://www.eclipse.org/articles/StyledText%202/article2.html
 http://www.eclipse.org/articles/Article-SWT-browser-widget/browser.html
 http://www.eclipse.org/articles/Article-SWT-OpenGL/opengl.html
 http://www.eclipse.org/articles/Article-SWT-DND/DND-in-SWT.html
 http://www.cs.umanitoba.ca/~eclipse/
Egads! When I opened this message my desk actually groaned under the weight of all those links. Sean
Feb 07 2006
prev sibling parent "Kris" <fu bar.com> writes:
Forgot this link for widget examples: http://www.eclipse.org/swt/widgets/


"pragma" <pragma_member pathlink.com> wrote in message 
news:dsab9v$280f$1 digitaldaemon.com...
 Let me be the first (of possibly many) to say: I don't have a clue how to
 program with SWT.

 With that in mind, could anyone steer me toward a solid tutorial on how to
 become familiarized with how SWT is organized?  How about how to do a 
 "Hello
 Windows World" application?  Tutorials?  Code comparisons to AWT or other 
 GUI
 libs?

 I'd love to start talking shop in this subgroup, but I really need to do 
 my
 homework first.

 Thanks,

 - Eric Anderton at yahoo 
Feb 07 2006