Regard All Phenomena As Dreams

2005-09-18

Note to Self: CHB and Workspace First...

I haven't been doing much the last few days (a friend's wedding, brief vacation in Maine, fun things like that....), but wanted to get back in and finish adding a couple basic things to my invoking TV3D to display a 'Hello World' window.

I had previously managed to use Dolphin's wizard to bring in the TrueVision 3D DLLs and it created all the necessary Smalltalk classes to use them. (I'm still very pleased with how smooth and easy that was!).

My first version of this opened a window that said 'Hello World' using the TrueVision 3D engine, but I didn't have it listening for a keystroke to finish up and close the window as the tutorial did, I had to manually invoke a method in my workspace. (Basic stuff, I know, but I gotta start somewhere....) So, I thought it would be a simple matter to have the test listen for a keystroke and respond to that rather than wait for a manual method invocation.

For the most part, it was easy, but at one point I ran into a minor question that frustrated me because I used my typical way of trying to find a solution rather than a more 'Smalltalk-appropriate' way:

The TV3D example I was following had you wait for the user to press the Escape key in order to close the tutorial window. It was easy to instantiate a TVInputEngine (their class to deal with keyboard, mouse, joystick and other inputs), but I had no clue where to find the constant their example used to identify that the Escape key was hit. (CONST_TV_KEY.TV_KEY_ESCAPE). I started out by hunting around in Google and such, with little luck. (Using TV3D with Dolphin is a rather obscure topic...) Then I happened to look at the class comments in more detail, and saw the reference to a poolDictionary 'TrueVision3DConstants' in the Class definition for the TVEngine class. From there it was a simple matter to browse to the PoolDictionary object, see how it worked, and play around for a bit in a Workspace. For example, I quickly found out I didn't need to prefix with CONST_TV_KEY from a little trial-and-error in the Workspace.

The lesson I learned is that there is a huge amount of info at your fingertips in the Class Hierarchy Browser, and, unlike working in Java or .Net where Googling for answers is often your best bet, a quick trip thru the CHB and some simple tests via a Workspace is a convenient and more efficient approach when stumped.

3 Comments:

  • Thanks to the efforts of Bill Schwab and Ian Bartholomew, Dolphin also has DSDN, which allows you to search the HTML docs, the newsgroups (the old private one and the newer public one), the Wiki (which is pretty much dead now), and source code and comments in the image -- with a single action. Not that it would have helped you much in this case.

    Another minor gotcha with translating the TV3D examples: the VB code uses "global" functions that are invoked in Dolphin by sending a message to an instance of TVGlobals.

    By Anonymous Aaron Wieland, at 10:25 PM  

  • Thanks for the tips, Aaron! :-D

    By Blogger Eddie, at 11:29 PM  

  • The Dolphin documentation contains some real gems; and sometimes they show up in a sections where you would not expect to look (for example, Ctrl+Shift+S formats a method is mentioned in the patterns section). Additionally, you read about things like constant pools which initially leaving you saying to yourself "why would I care about those...". As such, I got a lot out of reading "every single line" of available documentation.

    By Anonymous Anonymous, at 2:26 PM  

Post a Comment

<< Home