[vwnc] VW 7.6: Swapping a grid at runtime?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

[vwnc] VW 7.6: Swapping a grid at runtime?

Mike Bielser
I have a Grid and a List widget in a window and need to change/swap one grid for another depending
on what's selected in the list (i.e. the dimensions of the grid will change as well as what will be
displayed). I tried using a ViewHolder as well as a Grid, but somehow it does not work (meaning the
widget/component either does not update or shows a garbled matrix. Does anybody have any hints?

Mike

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] VW 7.6: Swapping a grid at runtime?

Reinout Heeck-2
Mike Bielser wrote:
> I have a Grid and a List widget in a window and need to change/swap one grid for another depending
> on what's selected in the list (i.e. the dimensions of the grid will change as well as what will be
> displayed). I tried using a ViewHolder as well as a Grid, but somehow it does not work (meaning the
> widget/component either does not update or shows a garbled matrix. Does anybody have any hints?
>
>  

I've done the following successfully for a dataset where the number of
columns depended on a user selection:

Create a canvas with your list and a subcanvas holder that will be used
to show the dataset/grid.

When the selection in the list changes have the ApllicationModel
dynamically instantiate a WindowSpec populated with the needed wrappers
and spec for a dataset/grid. Most of this structure is constant but you
will want to dynamically insert column specs in the case of a dataset.
(You could decide to create and persist this Spec in the usual way with
the UI painter, instantiate it and then amend the column properties).

Now that the spec is created the ApplicationModel can ask its builder
for a new sub builder and tell the subcanvas holder to use this spec and
builder to show the new dataset.


Doing the switching at the level of canvasses means that you will be
using a well exercised switching mechanism - you don't need to worry
much about widgets not being properly hooked up.



HTH,

Reinout
-------

> Mike
>
> _______________________________________________
> 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
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] VW 7.6: Swapping a grid at runtime?

Reinout Heeck
Reinout Heeck wrote:
>  have the ApllicationModel
> dynamically instantiate a WindowSpec populated with the needed wrappers
> and spec for a dataset/grid.

Correction: the builder will take care of the wrappers.
Yet another thing you don't need to worry about :-)


R
-
_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] VW 7.6: Swapping a grid at runtime?

Mike Bielser
In reply to this post by Reinout Heeck-2
Dear Reinout
thanks a million for your hint! I'll try it and let you know. I actually did take a look at
"Subcanvas" but (probably unfortunately) to me it sounded
- complicated/intimidating
- like overkill
I'll give it at try; at least it worked for you --> technically feasible ;)

General musing: It's problems like the one I have right now that make me wonder why it's not A LOT
easier to achieve the goal. It's not a Smalltalk problem per se (language-wise) rather probably of
the framework/implementation (VW 7.6 in this case). Especially given that "Smalltalk" and "dynamic"
are almost used synonymously, I believe it should take two lines (max) to swap a dataset/grid in/out
dynamically. I sometimes have the uneasy feeling that what I gain (productivity-wise) by using
Smalltalk, I loose by having to deal with a complicated/stubborn/unwieldy framework. That said, I DO
love Smalltalk and other language-framework combinations (Java, maybe? ;) ) might be worse;
sometimes there's this little nagging guy sitting in my ear wispering "it might be better/easier
elsewhere".

Thanks again
Mike

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] VW 7.6: Swapping a grid at runtime?

Alex Baran
Mike,

If I recall correctly, subcanvas changing can be done fairly easy. For example, you can draw each grid separately and store them as grid1Spec and grid2Spec. Then changing to grid2 can be look like:

YourAppModel>>changeSubcanvas

    (self widgetAt: #subcanvasName)
        client: self
        spec: #grid2Spec
        builder: builder

For changing grid contents, SelectionInList>>list: can be used.



--
Alex Baran
I'm looking for Smalltalk job
http://aleksijb.googlepages.com/resume.htm

2008/10/24 Mike Bielser <[hidden email]>
Dear Reinout
thanks a million for your hint! I'll try it and let you know. I actually did take a look at
"Subcanvas" but (probably unfortunately) to me it sounded
- complicated/intimidating
- like overkill
I'll give it at try; at least it worked for you --> technically feasible ;)

General musing: It's problems like the one I have right now that make me wonder why it's not A LOT
easier to achieve the goal. It's not a Smalltalk problem per se (language-wise) rather probably of
the framework/implementation (VW 7.6 in this case). Especially given that "Smalltalk" and "dynamic"
are almost used synonymously, I believe it should take two lines (max) to swap a dataset/grid in/out
dynamically. I sometimes have the uneasy feeling that what I gain (productivity-wise) by using
Smalltalk, I loose by having to deal with a complicated/stubborn/unwieldy framework. That said, I DO
love Smalltalk and other language-framework combinations (Java, maybe? ;) ) might be worse;
sometimes there's this little nagging guy sitting in my ear wispering "it might be better/easier
elsewhere".

Thanks again
Mike

_______________________________________________
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
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] VW 7.6: Swapping a grid at runtime?

Reinout Heeck
Alex Baran wrote:

> Mike,
>
> If I recall correctly, subcanvas changing can be done fairly easy. For
> example, you can draw each grid separately and store them as grid1Spec
> and grid2Spec. Then changing to grid2 can be look like:
>
> YourAppModel>>changeSubcanvas
>
>     (self widgetAt: #subcanvasName)
>         client: self
>         spec: #grid2Spec
>         builder: builder
>

Hmmm yes, but having multiple passivated specs seems a bit hackish to me.

Instead of passing a symbol for the spec you can pass an actual spec
instance to above method.

If you dynamically create these spec instances you get a generic
solution for any (reasonable) number of columns.

R
-





> For changing grid contents, SelectionInList>>list: can be used.
>
>
>
> --
> Alex Baran
> I'm looking for Smalltalk job
> http://aleksijb.googlepages.com/resume.htm
>
> 2008/10/24 Mike Bielser <[hidden email]
> <mailto:[hidden email]>>
>
>     Dear Reinout
>     thanks a million for your hint! I'll try it and let you know. I
>     actually did take a look at
>     "Subcanvas" but (probably unfortunately) to me it sounded
>     - complicated/intimidating
>     - like overkill
>     I'll give it at try; at least it worked for you --> technically
>     feasible ;)
>
>     General musing: It's problems like the one I have right now that
>     make me wonder why it's not A LOT
>     easier to achieve the goal. It's not a Smalltalk problem per se
>     (language-wise) rather probably of
>     the framework/implementation (VW 7.6 in this case). Especially given
>     that "Smalltalk" and "dynamic"
>     are almost used synonymously, I believe it should take two lines
>     (max) to swap a dataset/grid in/out
>     dynamically. I sometimes have the uneasy feeling that what I gain
>     (productivity-wise) by using
>     Smalltalk, I loose by having to deal with a
>     complicated/stubborn/unwieldy framework. That said, I DO
>     love Smalltalk and other language-framework combinations (Java,
>     maybe? ;) ) might be worse;
>     sometimes there's this little nagging guy sitting in my ear
>     wispering "it might be better/easier
>     elsewhere".
>
>     Thanks again
>     Mike
>
>     _______________________________________________
>     vwnc mailing list
>     [hidden email] <mailto:[hidden email]>
>     http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> 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
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] VW 7.6: Swapping a grid at runtime?

Alex Baran


2008/10/24 Reinout Heeck <[hidden email]>
Alex Baran wrote:
> Mike,
>
> If I recall correctly, subcanvas changing can be done fairly easy. For
> example, you can draw each grid separately and store them as grid1Spec
> and grid2Spec. Then changing to grid2 can be look like:
>
> YourAppModel>>changeSubcanvas
>
>     (self widgetAt: #subcanvasName)
>         client: self
>         spec: #grid2Spec
>         builder: builder
>

Hmmm yes, but having multiple passivated specs seems a bit hackish to me.

Instead of passing a symbol for the spec you can pass an actual spec
instance to above method.

If you dynamically create these spec instances you get a generic
solution for any (reasonable) number of columns.


If dynamism is the point I agree. The mix of two approaches sometimes useful too. The static part can be builded with GUI builder and dynamic part can be changed on the fly. 
For example, column replacing may be accomplished in this manner:

newColumn := (DataSetColumnSpec new)
        model:  myModel;
         width: 100;
        ...

(self widgetAt: #grid)
   removeColumnAt: 1;
   insertColumn: newColumn
        at: 1
        with: builder 

 

R
-





> For changing grid contents, SelectionInList>>list: can be used.
>
>
>
> --
> Alex Baran
> I'm looking for Smalltalk job
> http://aleksijb.googlepages.com/resume.htm
>
> 2008/10/24 Mike Bielser <[hidden email]
> <mailto:[hidden email]>>
>
>     Dear Reinout
>     thanks a million for your hint! I'll try it and let you know. I
>     actually did take a look at
>     "Subcanvas" but (probably unfortunately) to me it sounded
>     - complicated/intimidating
>     - like overkill
>     I'll give it at try; at least it worked for you --> technically
>     feasible ;)
>
>     General musing: It's problems like the one I have right now that
>     make me wonder why it's not A LOT
>     easier to achieve the goal. It's not a Smalltalk problem per se
>     (language-wise) rather probably of
>     the framework/implementation (VW 7.6 in this case). Especially given
>     that "Smalltalk" and "dynamic"
>     are almost used synonymously, I believe it should take two lines
>     (max) to swap a dataset/grid in/out
>     dynamically. I sometimes have the uneasy feeling that what I gain
>     (productivity-wise) by using
>     Smalltalk, I loose by having to deal with a
>     complicated/stubborn/unwieldy framework. That said, I DO
>     love Smalltalk and other language-framework combinations (Java,
>     maybe? ;) ) might be worse;
>     sometimes there's this little nagging guy sitting in my ear
>     wispering "it might be better/easier
>     elsewhere".
>
>     Thanks again
>     Mike
>
>     _______________________________________________
>     vwnc mailing list
>     [hidden email] <mailto:[hidden email]>
> ------------------------------------------------------------------------
>
> _______________________________________________
> 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


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] VW 7.6: Swapping a grid at runtime?

Reinout Heeck

On Oct 24, 2008, at 3:23 PM, Alex Baran wrote:

>
> For example, column replacing may be accomplished in this manner:
>
> newColumn := (DataSetColumnSpec new)
>         model:  myModel;
>          width: 100;
>         ...
>
> (self widgetAt: #grid)
>    removeColumnAt: 1;
>    insertColumn: newColumn
>         at: 1
>         with: builder
>
>

Which can be contrasted with the earlier exclamation:

> >     General musing: It's problems like the one I have right now that
> >     make me wonder why it's not A LOT
> >     easier to achieve the goal. It's not a Smalltalk problem per se
> >     (language-wise) rather probably of
> >     the framework/implementation (VW 7.6 in this case). Especially  
> given
> >     that "Smalltalk" and "dynamic"
> >     are almost used synonymously, I believe it should take two lines
> >     (max) to swap a dataset/grid in/out
> >     dynamically. I sometimes have the uneasy feeling that what I  
> gain
> >     (productivity-wise) by using
> >     Smalltalk, I loose by having to deal with a
> >     complicated/stubborn/unwieldy framework.


What Smalltalk fails to communicate (IMO) is which frameworks you are  
using here.

We have the View and Controller framework (which is quite dynamic) on  
top of which we have the Spec+Builder framework which takes view  
construction to a more productive abstract level (but still dynamic,  
see the code above) and then there is the UIPainter+passivated specs  
framework which suggests a more static view on UI implementation.


It is an old wish of mine that the system browser shows this code  
layering more prominently...


Cheers,

Reinout
-------







> That said, I DO
> >     love Smalltalk and other language-framework combinations (Java,
> >     maybe? ;) ) might be worse;
> >     sometimes there's this little nagging guy sitting in my ear
> >     wispering "it might be better/easier
> >     elsewhere".
> >
> >     Thanks again
> >     Mike
> >
> >     _______________________________________________
> >     vwnc mailing list
> >     [hidden email] <mailto:[hidden email]>
> >     http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
> >
> >
> >
> >  
> ------------------------------------------------------------------------
> >
> > _______________________________________________
> > 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
>
> _______________________________________________
> 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
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] VW 7.6: Swapping a grid at runtime?

Mike Bielser
Dear Reinout, Dear
sorry for the delay in answering and thank you so much for your suggestions. I tried using a
subcanvas, but unfortunately it does not work (consistently). I'm currently trying to figure out
what is going on. It's rather puzzling because opening four different windows in a workspace (each
containing a grid/dataset) DOES work. Really peculiar...

Mike

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] VW 7.6: Swapping a grid at runtime?

Mike Bielser
Uups, my brain was faster than my fingers: It should read " Dear Reinout, Dear Alex" of course...

Mike

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc