From maintainers-request at octave dot org Thu Aug 18 12:10:39 2005 Subject: Re: handle graphics with Document/View design From: Brian Blais To: "John W. Eaton" Cc: jswensen at intergate dot com, maintainers@octave.org Date: Thu, 18 Aug 2005 13:05:27 -0400 John W. Eaton wrote: > On 18-Aug-2005, Brian Blais wrote: > > | In my implementation of the gui for octave (at > | http://web.bryant.edu/~bblais/octave) I have just that: an octave > | structure array, and there is a "handle" field. Then I do: > | > | handles=[uiobjects.handle]; > | idx=find(handles==h); > | > | to find the actual index to the array. It is pretty fast. > | > | all of the set/get operations do the same thing. > > So all the uiobjects are in a flat structure array? yes, I did this for ease of implementation. I make no claims that it is the ideal way of doing it. > What if the set > of uiobjects is arranged in a tree structure, where one uiobject might > have other uiobjects as children? Then I don't think the find trick > is enough. In that case, wouldn't you need to search through the tree > recursively, looking at each set of children in the uiobject tree? I think that is correct. I don't know how fast that would be. at the time of my implementation, I was just trying to get *something* to work. I've been able to do quite complex interfaces with my implementation, and it is very similar to the syntax for matlab. in my implementation, the objects do have children, but they are simply handles which then get changed to indices into a flat array. bb -- ----------------- bblais at bryant dot edu http://web.bryant.edu/~bblais