listbox sort without change event (REALbasic getting started Mailinglist archive)
Back to the thread list
Previous thread: Coding for Mac Classic
Next thread: NUG list again
| listbox sort without change event |
| Date: 07.05.06 20:31 (Sun, 7 May 2006 19:31:20 EDT) |
| From: GAmoore aol.com |
|
I noticed that when I change an item in a listbox, the change event is
getting fired multiple times because I am redrawing the list, sorting, etc. I want to make it sort without firing the change event. Seth and others had an idea for making a popup not fire the change event when it was changed from code rather than manually by the user. The idea was to make a custom popup class with a "change_from_code" boolean. Then there is a single method "setIndex( j )" which simply sets the list index. And this scheme works. And in the open even there is initialization of that flag to be true by default. However, I would like to do the sort of a listbox in the same sort of way. I can't just sent an index value in this case. Is there a way to adapt this idea? _______________________________________________ Unsubscribe or switch delivery mode: <http://www.realsoftware.com/support/listmanager/> Search the archives of this list here: <http://support.realsoftware.com/listarchives/lists.html> |
| Re: listbox sort without change event |
| Date: 08.05.06 00:40 (Sun, 7 May 2006 19:40:35 -0400) |
| From: Charles Yeomans |
|
On May 7, 2006, at 7:31 PM, <email address removed> wrote: > I noticed that when I change an item in a listbox, the change event is > getting fired multiple times because I am redrawing the list, > sorting, etc. I want > to make it sort without firing the change event. > > Seth and others had an idea for making a popup not fire the change > event when > it was changed from code rather than manually by the user. The idea > was to > make a custom popup class with a "change_from_code" boolean. Then > there is a > single method "setIndex( j )" which simply sets the list index. And > this scheme > works. And in the open even there is initialization of that flag to > be true > by default. > > However, I would like to do the sort of a listbox in the same sort > of way. I > can't just sent an index value in this case. Is there a way to > adapt this > idea? Sure. Add a property BlockChange as Boolean. Then implement the Change event handler of your Listbox subclass as follows. Sub Change() If BlockChange then Return End if Change End Sub I'm a little surprised that sorting the Listbox would call the Change event handler; are you sorting using Listbox.Sort? Charles Yeomans _______________________________________________ Unsubscribe or switch delivery mode: <http://www.realsoftware.com/support/listmanager/> Search the archives of this list here: <http://support.realsoftware.com/listarchives/lists.html> |
| Re: listbox sort without change event |
| Date: 08.05.06 03:29 (Sun, 7 May 2006 19:29:46 -0700) |
| From: Seth Willits |
|
On May 7, 2006, at 4:31 PM, <email address removed> wrote:
> I noticed that when I change an item in a listbox, the change event is > getting fired multiple times because I am redrawing the list, > sorting, etc. I want > to make it sort without firing the change event. Ahhh the wonders of a truly backwards system. ;^) (Backwards as opposed to not storing the data in the control and actually just having the control _display_ the data) > However, I would like to do the sort of a listbox in the same sort > of way. I > can't just sent an index value in this case. Is there a way to > adapt this > idea? The same idea should work just as Charles said. Seth Willits ---------------------------------------------------------- Freak Software - http://www.freaksw.com/ ResExcellence - http://www.resexcellence.com/realbasic/ ---------------------------------------------------------- _______________________________________________ Unsubscribe or switch delivery mode: <http://www.realsoftware.com/support/listmanager/> Search the archives of this list here: <http://support.realsoftware.com/listarchives/lists.html> |
| Re: listbox sort without change event |
| Date: 10.05.06 18:29 (Wed, 10 May 2006 17:29:20 EDT) |
| From: GAmoore aol.com |
|
> I'm a little surprised that sorting the Listbox would call the Change
> event handler; are you sorting using Listbox.Sort? > THanks for your suggestion Charles. I'll try to implement it. Yes, I am using Listbox.sort. And from going through the debugger it seems to be the line which is firing the change event. Seth wrote : > > I noticed that when I change an item in a listbox, the change event is > > getting fired multiple times because I am redrawing the list, > > sorting, etc. I want > > to make it sort without firing the change event. > > Ahhh the wonders of a truly backwards system. ;^) > > (Backwards as opposed to not storing the data in the control and > actually just having the control _display_ the data) > I am not sure if my approach is backwards or not, but I have some interlocking arrays of data which are used in different ways, and so I keep the data internal and then display only a portion of it depending on the circumstances. In fact, the user can filter the data in various ways. (E.g. show only fulltime employees, or parttime employees, or all employees, or those working overtime, etc). This makes it easier to manage large lists of data by looking at subsets. _______________________________________________ Unsubscribe or switch delivery mode: <http://www.realsoftware.com/support/listmanager/> Search the archives of this list here: <http://support.realsoftware.com/listarchives/lists.html> |
| Re: listbox sort without change event |
| Date: 10.05.06 22:42 (Wed, 10 May 2006 17:42:56 -0400) |
| From: Charles Yeomans |
|
On May 10, 2006, at 5:29 PM, <email address removed> wrote: >> I'm a little surprised that sorting the Listbox would call the Change >> event handler; are you sorting using Listbox.Sort? >> > THanks for your suggestion Charles. I'll try to implement it. > > Yes, I am using Listbox.sort. And from going through the debugger > it seems to > be the line which is firing the change event. Indeed it is; I just tested it. This doesn't seem like the right behavior to me. > > Seth wrote : >>> I noticed that when I change an item in a listbox, the change >>> event is >>> getting fired multiple times because I am redrawing the list, >>> sorting, etc. I want >>> to make it sort without firing the change event. >> >> Ahhh the wonders of a truly backwards system. ;^) >> >> (Backwards as opposed to not storing the data in the control and >> actually just having the control _display_ the data) >> > I am not sure if my approach is backwards or not, but I have some > interlocking arrays of data which are used in different ways, and > so I keep the data > internal and then display only a portion of it depending on the > circumstances. In > fact, the user can filter the data in various ways. (E.g. show only > fulltime > employees, or parttime employees, or all employees, or those working > overtime, etc). This makes it easier to manage large lists of data > by looking at > subsets. Your approach is not backward; it's a consequence of using the Rb Listbox. Seth is under the influence of Cocoa and its use of MVC; it will wear off eventually. Charles Yeomans _______________________________________________ Unsubscribe or switch delivery mode: <http://www.realsoftware.com/support/listmanager/> Search the archives of this list here: <http://support.realsoftware.com/listarchives/lists.html> |
| Re: listbox sort without change event |
| Date: 11.05.06 01:43 (Wed, 10 May 2006 17:43:46 -0700) |
| From: Seth Willits |
|
On May 10, 2006, at 2:29 PM, <email address removed> wrote:
> Seth wrote : >> Ahhh the wonders of a truly backwards system. ;^) >> >> (Backwards as opposed to not storing the data in the control and >> actually just having the control _display_ the data) >> > I am not sure if my approach is backwards or not Oh no, not you, I meant REALbasic. You're good. :) Seth Willits ---------------------------------------------------------- Freak Software - http://www.freaksw.com/ ResExcellence - http://www.resexcellence.com/realbasic/ ---------------------------------------------------------- _______________________________________________ Unsubscribe or switch delivery mode: <http://www.realsoftware.com/support/listmanager/> Search the archives of this list here: <http://support.realsoftware.com/listarchives/lists.html> |
Links
MBS Realbasic PDF Plugins - Christians Software aus Nickenich