Just about the time I think I have Spec layouts figured out, I stump myself all over again. I have a layout that I want to have two variable width columns and one fixed width column. I have created three columns in a row. When I put a single widget in each column, then the columns display as equal sizes and spread equally across the row. However, when I set the third column to a fixed width, then the first column takes up half of the width row and the other two widgets share the other half of the row. I have tried several ways to solve this to no avail. Here is my current layout. ^SpecLayout composed newRow: [ :r | r newColumn: [ :c | c add: #tblTxt ]. r newColumn: [ :c | c add: #colTxt ]. r newColumn: [ :c | c newRow: [ :row | row add: #editButton width: self toolbarHeight. row add: #deleteButton width: self toolbarHeight ]] width: 60 ] height: self toolbarHeight yourself What am I doing wrong.
Brad Selfridge
|
Hi Brad,
a quick solution could be to group the first two columns in this way: WidgetBrad class>>defaultSpec ^ SpecLayout composed newRow: [ :r | r newColumn: [ :f | f newRow: [ :k | k newColumn: [ :c | c add: #tblTxt ]. k newColumn: [ :c | c add: #colImg ] ] ]. r newColumn: [ :c | c newRow: [ :row | row add: #editButton width: self toolbarHeight. row add: #deleteButton width: self toolbarHeight ] ] width: 60 ] height: self toolbarHeight yourself In general Spec seem to work by "offsets", even when we define the "width" of a column. In order to see how effectively Spec manages the offsets, of your widget, try this code: WidgetBrad defaultSpec asArray. it should return an array with the layout of the widget, and its subcomponents. Bye, Matteo On 26/10/16 23:06, Brad Selfridge wrote: > > > Just about the time I think I have Spec layouts figured out, I stump myself > all over again. > > I have a layout that I want to have two variable width columns and one fixed > width column. I have created three columns in a row. When I put a single > widget in each column, then the columns display as equal sizes and spread > equally across the row. However, when I set the third column to a fixed > width, then the first column takes up half of the width row and the other > two widgets share the other half of the row. I have tried several ways to > solve this to no avail. Here is my current layout. > > ^SpecLayout composed > newRow: [ :r | > r newColumn: [ :c | c add: #tblTxt ]. > r newColumn: [ :c | c add: #colTxt ]. > r newColumn: [ :c | > c newRow: [ :row | > row add: #editButton width: self toolbarHeight. > row add: #deleteButton width: self toolbarHeight ]] width: 60 > ] height: self toolbarHeight > yourself > > > What am I doing wrong. > > > > > > ----- > Brad Selfridge > -- > View this message in context: http://forum.world.st/Spec-Layout-Problems-tp4920329.html > Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com. > |
Free forum by Nabble | Edit this page |