Newsgroups: comp.lang.smalltalk
Path: cantaloupe.srv.cs.cmu.edu!europa.chnt.gtegsc.com!howland.reston.ans.net!ix.netcom.com!netcom.com!billw
From: billw@netcom.com (William Wright)
Subject: ParcPlace Menu Buttons
Message-ID: <billwDAqEsE.C05@netcom.com>
Organization: NETCOM On-line Communication Services (408 261-4700 guest)
Date: Sun, 25 Jun 1995 13:57:50 GMT
Lines: 35
Sender: billw@netcom4.netcom.com


ParcPlace VisualWorks 2.0 Problem with Menu Buttons


Within VisualWorks there is a UI widget called a menu
button. This is basically a dropdown selection list. Ideally
the list given to the MenuButton is a list of objects. Unfortunately,
this cannot be used effectively because of what I think is an error
in the ParcPlace code. When a new item is selected the following
method gets called:

	dispathMenuSelection: menuSelection
		menuSelection = 0 ifTrue: [ ^self]
		...

Here menuSelection is the selected object from the list. Well, 
frequently the #= message is overridden for user defined objects
so that they can be compared with other objects of the same type.
Unfortunately, when the argument to this method is a 0, then a 
walkback occurs. The above is a poor implementation for two
reasons. First, because it prevents proper use of the #= messages
by other objects. Second, because #= should never be used to 
compare with a literal constant, like 0. The #== message should
be used in this case. Not only is it the appropriate message 
functionally, but it is also more efficient.

Comments? Especially from ParcPlace. Do you agree or disagree
and why? Thanks for any input.

Bill Wright
-- 
Bill Wright	(billw@netcom.com)
             or (bill_wright@mail.amsinc.com)
Home: (303) 494-7232
Work: (303) 969-3583
