The Artima Developer Community
Sponsored Link

Agile Buzz Forum
Learning Widgetry as we go

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
Learning Widgetry as we go Posted: Mar 31, 2007 8:21 PM
Reply to this message Reply

This post originated from an RSS feed registered with Agile Buzz by James Robertson.
Original Post: Learning Widgetry as we go
Feed Title: Cincom Smalltalk Blog - Smalltalk with Rants
Feed URL: http://www.cincomsmalltalk.com/rssBlog/rssBlogView.xml
Feed Description: James Robertson comments on Cincom Smalltalk, the Smalltalk development community, and IT trends and issues in general.
Latest Agile Buzz Posts
Latest Agile Buzz Posts by James Robertson
Latest Posts From Cincom Smalltalk Blog - Smalltalk with Rants

Advertisement

One of the nice things about the Swallow (Twitter client) project that Michael and I have been working on is the fact that we decided to make it a Widgetry (Pollock) project. I hadn't really worked in Widgetry before, so it's been a learning experience - especially the lack of a GUI builder :)

Still, it's gone pretty well. Here's one of the things that nicer in Widgetry than it was in Wrapper: keyboard handling. Say you have an input field, and you want to look for a specific character. In Wrapper, you had to install a keyboardHook block on the controller, and then write all the handling code in the block (or in methods called from the block. In Widgetry, we register to get an Announcement:


	(self paneAt: #input) inputField 
		when: KeystrokeAboutToBeProcessed
		send: #possibleCREvent:
		to: self.

The pane in question is a combo-box, so I first grabbed the input field and then waited for the Announcement (which is an actual object). Here's the handler:


possibleCREvent: announcement
	"if the key pressed is a CR, then send the message"

	| key |
	key := announcement keystroke key.
	key = Character cr ifTrue: [self sendStatusNow].

Which seems more straightforward to me than the old keyboard handler setup - for one thing, I don't need to remember whether to return the keyboard event or nil :). Anyhow, it's a nice little project, and a nice experiment.

Technorati Tags: ,

Read: Learning Widgetry as we go

Topic: If everything is equally important, then nothing is important Previous Topic   Next Topic Topic: There's no reason, it's just the rules

Sponsored Links



Google
  Web Artima.com   

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