Hi all,
Is there a way to deny an attempt to take a single-selection List widget to an "unselected" state (where aList selection isNil)? Thanks, Ricky _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
Richard Wettel wrote:
> Hi all, > > Is there a way to deny an attempt to take a single-selection List > widget to an "unselected" state (where aList selection isNil)? AFAIK this is not readily available, you'll probably need to subclass and specialize the Controller of your list widget to achieve this effect. In practice we don't find this much of a problem because there are other ways to enforce selection, for instance by disabling an 'accept' button when there is no selection. In several of our applications we have a status bar at the bottom of their windows, part of this area is reserved for error messages ('No foo selected') that explain why an 'accept' button is disabled. Our users seem to like this arrangement. R - > > Thanks, > Ricky > _______________________________________________ > vwnc mailing list > [hidden email] > http://lists.cs.uiuc.edu/mailman/listinfo/vwnc > > -- ********************************************************************* Dit e-mailbericht is alleen bestemd voor de geadresseerde(n). Gebruik door anderen is niet toegestaan. Indien u niet degeadresseerde(n) bent wordt u verzocht de verzender hiervan op de hoogte te stellen en het bericht te verwijderen. Door de elektronische verzending kunnen aan de inhoud van dit bericht geen rechten worden ontleend. Soops B.V. is gevestigd te Amsterdam, Nederland, en is geregistreerd bij de Kamer van Koophandel onder nummer 33240368. Soops B.V. levert volgens de Fenit voorwaarden, gedeponeerd te Den Haag op 8 december 1994 onder nummer 1994/189. ********************************************************************** This e-mail message is intended to be exclusively for the addressee. If you are not the intended recipient you are kindly requested not to make any use whatsoever of the contents and to notify the sender immediately by returning this e-mail message. No rights can be derived from this message. Soops B.V. is a private limited liability company and has its seat at Amsterdam, The Netherlands and is registered with the Trade Registry of the Chamber of Commerce and Industry under number 33240368. Soops B.V. delivers according to the General Terms and Conditions of Business of Fenit, registered at The Hague, The Netherlands on December 8th, 1994, under number 1994/189 ********************************************************************** _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
First you need to know the current selection, so set up a "Validation" method for "Entry". When invoked, save the current selection and return "true" (to let the select go ahead). If you knew what the user was selecting here, you could probably return "false" -- not sure that info is available though. Then setup a "Notification" "Change" entry -- if the when that method is invoked the selection is nil, just re-select the saved item. (Actually you may not need the "Validation" method, you could probably put it in "Notification Entry" -- which ignores what you return -- my pattern has been Validation-Entry + Notification-Change). Reinout Heeck wrote: Richard Wettel wrote:Hi all, Is there a way to deny an attempt to take a single-selection List widget to an "unselected" state (where aList selection isNil)?AFAIK this is not readily available, you'll probably need to subclass and specialize the Controller of your list widget to achieve this effect. In practice we don't find this much of a problem because there are other ways to enforce selection, for instance by disabling an 'accept' button when there is no selection. In several of our applications we have a status bar at the bottom of their windows, part of this area is reserved for error messages ('No foo selected') that explain why an 'accept' button is disabled. Our users seem to like this arrangement. R -Thanks, Ricky _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc -- Dennis Smith +1 416.798.7948 Cherniak Software Development Corporation Fax: +1 416.798.0948 509-2001 Sheppard Avenue East [hidden email] Toronto, ON M2J 4Z8 <a class="moz-txt-link-freetext" href="sip:dennis@CherniakSoftware.com">sip:dennis@... Canada http://www.CherniakSoftware.com Entrance off Yorkland Blvd south of Sheppard Ave east of the DVP _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
On Jun 25, 2008, at 4:55 AM, Dennis Smith wrote:
> There is a way -- its not neat and clean. > > First you need to know the current selection, so set up > a "Validation" method for "Entry". When invoked, save > the current selection and return "true" (to let the select go ahead). > If you knew what the user was selecting here, you could probably > return "false" -- not sure that info is available though. > > Then setup a "Notification" "Change" entry -- if the > when that method is invoked the selection is nil, just > re-select the saved item. > > (Actually you may not need the "Validation" method, you could > probably put it in "Notification Entry" -- which ignores what > you return -- my pattern has been Validation-Entry + > Notification-Change). There is a way -- it works pretty well I think. For your list, add a callback for validation-->change. Call it something like #dontAllowUnselect: Then add that method to your ApplicationModel, implemented as such: dontAllowUnselect: aSequenceController ^aSequenceController view selectionIndex ~= aSequenceController view targetIndex Promote the method up to ApplicationModel as a class extension and reuse at will. The multi-selection variant is left to the student. :) -- Travis Griggs Objologist "Every institution finally perishes by an excess of its own first principle." - Lord Acton _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
Thanks for all your answers.
Cheers, Ricky > On Jun 25, 2008, at 4:55 AM, Dennis Smith wrote: > >> There is a way -- its not neat and clean. >> >> First you need to know the current selection, so set up >> a "Validation" method for "Entry". When invoked, save >> the current selection and return "true" (to let the select go ahead). >> If you knew what the user was selecting here, you could probably >> return "false" -- not sure that info is available though. >> >> Then setup a "Notification" "Change" entry -- if the >> when that method is invoked the selection is nil, just >> re-select the saved item. >> >> (Actually you may not need the "Validation" method, you could >> probably put it in "Notification Entry" -- which ignores what >> you return -- my pattern has been Validation-Entry + >> Notification-Change). > > > > There is a way -- it works pretty well I think. > > For your list, add a callback for validation-->change. Call it > something like #dontAllowUnselect: > > Then add that method to your ApplicationModel, implemented as such: > > dontAllowUnselect: aSequenceController > > ^aSequenceController view selectionIndex ~= aSequenceController view > targetIndex > > > Promote the method up to ApplicationModel as a class extension and > reuse at will. > > The multi-selection variant is left to the student. :) > > -- > Travis Griggs > Objologist > "Every institution finally perishes by an excess of its own first > principle." - Lord Acton > > > > _______________________________________________ > vwnc mailing list > [hidden email] > http://lists.cs.uiuc.edu/mailman/listinfo/vwnc _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
Free forum by Nabble | Edit this page |