[Pharo-users] Spec problem creating dynamci UIs

kmo voxkmp at gmail.com
Sat Mar 1 05:45:48 EST 2014


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.




More information about the Pharo-users mailing list