Hi everyone,
I am strugling with some strange behaviour on a menuButton. All I want to do is the button to come up with a default selection, in accordance with the value of its aspect. You can see its behaviour here: http://dl.dropbox.com/u/5848367/2011-04-25_1927.mp4 The widget seems very stuborn in refusing to display the selection given. It will only display a selection after it came up. Even digging into the widget doesn't help and even something like the below will not help anything. postBuildWith: aBuilder (self widgetAt: #MenuButton1) menu: self ressourceMenu default: (Resource new res_name: 'One') Anyone experienced solved this before. Regards, Maarten, _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
Hi.
I am not sure what is the problem you are having, hence I wrote a simple self-contained example - MenuButtonUI (see attachment). It might help you to play with it a little bit. MenuButtonUI let's you pick lowercase characters $a..$z from the menu button. Whenever you pick one, #characterChanged is evaluated. You can also pick a character by other means (methods #setA and #setZ), but the menu button will be updated nonetheless. [MenuButton usage] * Place a menu button to a canvas in UIPainter. * Select the menu button. * In its Basics tab, you can set its Aspect and Menu. * Aspect is a selector of a method that returns aValueModel of the menu button (#menuButtonAspect). * Menu is a selector of a method that returns aMenu presented to the user when the menu button is clicked. This method can also return aBlockClosure that will be evaluated each time a user clicks on the menu button (useful for dynamic menus). The block must return aMenu (#menuButtonMenu). * aMenu in turn consists of MenuItem-s. Each has a label and a value. Label is a string shown in the menu button widget. Value is any object set to the menu button's aspect when the user picks the corresponding MenuItem. In MenuButtonUI, value is aCharacter and label is String with: aCharacter. * When you wish to modify value of the menu button programmatically, you should simply change the value of its aspect and the menu button should update automatically (action methods #setA and #setZ). NOTE: For this to work, the value you set to the aspect must be the same (equal) to the value of a menu item from the menu button's menu. HTH, Ladislav Lenart On 25.4.2011 19:32, Maarten MOSTERT wrote: > Hi everyone, > > I am strugling with some strange behaviour on a menuButton. > > All I want to do is the button to come up with a default selection, in accordance with the value of its aspect. > > You can see its behaviour here: > > http://dl.dropbox.com/u/5848367/2011-04-25_1927.mp4 > > The widget seems very stuborn in refusing to display the selection given. It will only display a selection after it came up. > Even digging into the widget doesn't help and even something like the below will not help anything. > > postBuildWith: aBuilder > > (self widgetAt: #MenuButton1) menu: self ressourceMenu > default: (Resource new res_name: 'One') > > Anyone experienced solved this before. > > Regards, > > Maarten, > _______________________________________________ > 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 MenuButtonUI.st (5K) Download Attachment |
In reply to this post by Maarten Mostert-2
Hello.
We use Spellchecker2 as a means to spell check text-like documents in our application (#hasWord:) and now we are in the process of adding auto-correct suggestions (#suggestWords:). The first part works like a charm, but I have trouble with the second. The LevenshteinAutomata's class comment says it implements the following edit operations for distance of one: Add, Remove, Replace, Transpose, Merge, Split. However it seems to me that it does not return all valid candidates. I demonstrate the problems on the following vocabulary: v := Spellchecker2.Vocabulary new. v mutableWhile: [:n | #('a' 'b' 'aa' 'ab' 'ba' 'bb''ac') do: [:e | n addWord: e]. ]. [1] v suggestWords: 'aa'. Returns: #('a' 'aa'). I would expect the following: #( "deletion" 'a' "identity" 'aa' "replace" 'ba' "replace" 'ab' "replace" 'ac' ). [2] v suggestWords: 'ca'. Returns an empty collection. I would expect the following: #( "deletion" 'a' "replace" 'aa' "replace" 'ba' "transpose" 'ac' ). Are these bugs or am I missing something? Thx, Ladislav Lenart _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
Free forum by Nabble | Edit this page |