[Pharo-users] Spec problem creating dynamci UIs

Benjamin benjamin.vanryseghem.pharo at gmail.com
Sat Mar 1 10:29:57 EST 2014


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 at newHeight

And this should work

Ben

On 01 Mar 2014, at 11:45, kmo <voxkmp at gmail.com> 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.
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pharo.org/pipermail/pharo-users_lists.pharo.org/attachments/20140301/aacab701/attachment.html>


More information about the Pharo-users mailing list