Spec problem creating dynamci UIs

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

Spec problem creating dynamci UIs

kmo
I'm probably doing this all wrong, but I have a problem creating a dynamic UI with Spec.

I want a small window which shows more information when a Show more details button is clicked.

Here's an example.



when I click Show More I want something like this (a bigger window with more fields):



But when I change the Spec layout the window size remains the same as it was set in initialExtent - so it does not display properly with the extra fields.



I can't find any way of rebuilding the window so that it shows the bigger layout properly.

Here's the spec for the basic window:

basicSpec
<spec: #default>
|row1|

row1 := SpecLayout composed
        newRow: [ :row |
                row
                        add: #label1;
                        add: #field1
        ] height: self inputTextHeight;
        yourself.

       

^SpecLayout composed
        newColumn:[:column|
                column add:row1; addSplitter; add:#btnMode height: self toolbarHeight ; addSplitter].

Here's the spec for the detailed window:

detailedSpec
<spec>
|row2 row3|

row2 := SpecLayout composed
        newRow: [ :row |
                row
                        add: #label2;
                        add: #field2
        ] height: self inputTextHeight  ;
        yourself.
       
row3 := SpecLayout composed
        newRow: [ :row |
                row
                        add: #label3;
                        add: #field3
        ] height: self inputTextHeight  ;
        yourself.

^SpecLayout composed
         newColumn: [ :column |
        column
                add: self basicSpec;
            add: row2;
        add:row3
    ];
    yourself.




Here's the code that switches Spec layouts:
initializePresenter
        super initializePresenter.
        btnMode action:  
                [ self needRebuild: false.
                 self label1 needRebuild: false.
                self field1 needRebuild: false.
                self btnMode needRebuild: false.
                                               
                self buildWithSpecLayout: self class detailedSpec. ]



Is this a problem in Spec or just me being stupid?
Reply | Threaded
Open this post in threaded view
|

Re: Spec problem creating dynamci UIs

Benjamin Van Ryseghem (Pharo)
There is no way to tell to spec that this layout should automatically 
expand the window.
And I think this is not the default behaviour.

If you want to change the size you can still do manually

myModel extent: newWidth@newHeight

And this should work

Ben

On 01 Mar 2014, at 11:45, kmo <[hidden email]> wrote:

I'm probably doing this all wrong, but I have a problem creating a dynamic UI
with Spec.

I want a small window which shows more information when a /Show more
details/ button is clicked.

Here's an example.

<http://forum.world.st/file/n4747139/PharoScreenshot.6.png>

when I click /Show More/ I want something like this (a bigger window with
more fields):

<http://forum.world.st/file/n4747139/PharoScreenshot.8.png>

But when I change the Spec layout the window size remains the same as it was
set in /initialExtent/ - so it does not display properly with the extra
fields.

<http://forum.world.st/file/n4747139/PharoScreenshot.7.png>

I can't find any way of rebuilding the window so that it shows the bigger
layout properly.

Here's the spec for the basic window:

*basicSpec*
<spec: #default>
|row1|

row1 := SpecLayout composed
newRow: [ :row |
row
add: #label1;
add: #field1
] height: self inputTextHeight;
yourself.



^SpecLayout composed
newColumn:[:column|
column add:row1; addSplitter; add:#btnMode height: self toolbarHeight ;
addSplitter].

Here's the spec for the detailed window:

*detailedSpec*
<spec>
|row2 row3|

row2 := SpecLayout composed
newRow: [ :row |
row
add: #label2;
add: #field2
] height: self inputTextHeight  ;
yourself.

row3 := SpecLayout composed
newRow: [ :row |
row
add: #label3;
add: #field3
] height: self inputTextHeight  ;
yourself.

^SpecLayout composed
newColumn: [ :column |
       column
add: self basicSpec;
           add: row2;
add:row3
   ];
   yourself.




Here's the code that switches Spec layouts:
*initializePresenter*
super initializePresenter.
btnMode action:  
[ self needRebuild: false.
self label1 needRebuild: false.
self field1 needRebuild: false.
self btnMode needRebuild: false.

self buildWithSpecLayout: self class detailedSpec. ]



Is this a problem in Spec or just me being stupid?




--
View this message in context: http://forum.world.st/Spec-problem-creating-dynamci-UIs-tp4747139.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.


kmo
Reply | Threaded
Open this post in threaded view
|

Re: Spec problem creating dynamci UIs

kmo
self extent: and self  window extent: do not work. First thing i tried.