The Artima Developer Community
Sponsored Link

Agile Buzz Forum
Prototype Powertool: VisualBlock

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
James Robertson

Posts: 29924
Nickname: jarober61
Registered: Jun, 2003

David Buck, Smalltalker at large
Prototype Powertool: VisualBlock Posted: Oct 10, 2005 1:26 PM
Reply to this message Reply

This post originated from an RSS feed registered with Agile Buzz by James Robertson.
Original Post: Prototype Powertool: VisualBlock
Feed Title: Travis Griggs - Blog
Feed URL: http://www.cincomsmalltalk.com/rssBlog/travis-rss.xml
Feed Description: This TAG Line is Extra
Latest Agile Buzz Posts
Latest Agile Buzz Posts by James Robertson
Latest Posts From Travis Griggs - Blog

Advertisement

One of the coolest objects in the graphics/view framework for VisualWorks is the VisualBlock.

VisualBlock is a block with a bounds. Many of the views/widgets we put together are just a fancy displayOn: message. It came in really handy, in creating an "icon" that was two OpaqueImages side by side. Given the desire to create an "aggregate" icon by showing two OpaqueImages side by side, you have a couple of choices:

  1. Create a special object. A subclass of VisualComponent. Two instance variables. Add the various bounds messages. Your displayOn: message. If this is a very common thing to do in your system, then this is actually probably the right thing to do.
  2. Synthesize a new OpaqueImage which is the two put together. Means you have to create a separate Mask and Pixmap, draw the OpaqueImage figures/shapes onto it at the right places. Return a new OpaqueImage after turning them back into Images. Kind of yecky, and it'll work the heck out of your graphics server.
  3. Just use a VisualBlock. Something like:
  4. graphic := VisualBlock block: [:gc :box |
      icon1 displayOn: gc at: box origin.
      icon2 displayOn: gc at: (box origin right: icon1 width).
    ] bounds: (Point zero corner:  icon1 width + icon2 width @ icon1 height).
    ^graphic

To me, the VisualBlock is very appealing. It was quick and easy to throw together. I can experiment with different layouts. And it doesn't thrash the graphics layer.

VisualBlock exists under the current "wrappers" framework, I have no idea if there's such a thing for Pollock yet. But if there's not, I'll bet its one of the first things I slap together.

Read: Prototype Powertool: VisualBlock

Topic: Floating a Smalltalk Balloon Previous Topic   Next Topic Topic: IDE for Ruby on Rails

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use