O$ assign instantiated window to a subwindow

Denis Woodbury denis at woodmic.net
Mon Dec 1 10:56:24 EST 2014


Hi Bastiaan,

Thanks for taking the time to share your opinion and suggestions, it¹s
always interesting (reassuring) to see how others do things and with
Studio there so much stuff there¹s always a possibility of overlooking
e.g..:$multipleclasses

30 instances is just a possibility, but in general use, some users might
only access a few of the windows and go back and forth between them, as
for outdated data, only a few will have auto refresh, the other will have
a Refresh Button (they are used to that)

I¹m trying out $multipleclasses as ktrue and got another question

Is there a way to make a list of the cached classes (those that have been
used) and close some of them from that list?

Been playing around with $subinst with no luck

denis




Le 2014-11-28, 4:46 PM, « Bastiaan Olij » <bastiaan at basenlily.me> a écrit :

>Hey Denis,
>
>$multipleclasses may be just what you need, I haven't used that one.
>
>I personally don't like the 30 instances of subwindows option, very
>resource hungry. Also, and I don't know if this applies to you, if you
>go back to a pane that hasn't been displayed for the last 3 minutes the
>data may be outdated. Loading the data back from a database costs very
>little (especially with worker object, owh I've seen the light since
>EurOmnis, absolutely loving these!)
>
>I do switch between the subwindow by assigning $classname causing my
>subwindow to be destructed and my new subwindow to be constructed. But I
>use the following approach to retain the part of the state of the
>subwindow I wish to keep.
>
>In my main window I have defined a list called ivStates with columns
>"ClassName" (character) and "Data" (list). That list has an entry for
>every "pane" with the data list simply empty. I use the line number as
>an index so I could have a pane showing the same subwindow as another
>but with different data.
>
>Then to change the subwindow I have the following method:
>----
>wParentWindow.DetailField.$changeToTab(pvPaneNumber)
>--
>If ivCurrentPane <> pvPaneNumber ;; ivCurrentPane holds the current pane
>I'm showing
>    If ivCurrentPane <> 0 ;; ivCurrentPane is 0 when the window first
>opens..
>        Do $cinst.$objs.DetailField.$saveState() Returns lvList
>        Calculate ivStates.[ivCurrentPane].Data as lvList
>    End If;
>
>    Calculate ivCurrentPane as pvPaneNumber
>    Calculate $cinst.$objs.DetailField.$classname as
>ivStates.[ivCurrentPane].ClassName
>    Do 
>$cinst.$objs.DetailField.$restoreState(ivStates.[ivCurrentPane].Data)
>End If;
>----
>
>$saveState and $restoreState are methods that I've implemented on every
>subwindow obviously added to a base class from which all subwindows are
>subclassed. $saveState returns a list of the subwindows chosing that
>holds whatever data the subwindow wants saved, $restoreState holds code
>that restores the state. The first time a pane is used the list I sent
>to $restoreState is an empty list without columns so my subwindow knows
>it needs to start with a clean slate.
>
>This does mean that the $construct of my subwindow holds only basic
>logic and the real heavy lifting is done in $restoreState.
>
>Cheers,
>
>Bas





More information about the omnisdev-en mailing list