Question

I am trying to make a window show up, but i keep getting a message not understood error. The snippet:

Window new
  label: 'Hello';
  open
Was it helpful?

Solution 2

Ok, for a game like that you want to use a custom control. You start by creating a subclass of View for your game and override the displayOn: method to display the view. You can add the view to the UIPainter canvas using a ViewHolder. Set the View: property to be the name of a method that returns your custom view.

To intercept mouse clicks, you'll need to have a custom controller for your view. You'll subclass Controller or one of its subclasses to create the Controller. A method called defaultControllerClass in the View returns the name of the controller class. In the controller, you can intercept mouse events.

I suggest that you load an example game to get you started. Open the Parcel Manager, and select Toys from the list. You should see SpiderSolitaire there. This is a game written for VisualWorks that displays a custom view, does some simple animation on that view, and intercepts mouse events. That should serve as a good example to use.

OTHER TIPS

You can use this:

ScheduledWindow new
    label: 'Hello';
    open

Or to open larger:

ScheduledWindow new
    label: 'Hello';
    openIn: (20@20 extent: 300@300)

I suspect, however, that this isn't what you really want to do since it's hard to work with a window that's built this way. Can you explain more about what you want to do?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top