Hi,
I would like to create a Text Morph that wraps the text horizontally, and expands the height to fit the text. Thus, this morph would never offer scrolling. How could I do that? Cheers, Doru -- www.tudorgirba.com "There are no old things, there are only old ways of looking at them." |
Hi Doru
|textMorph| textMorph := UITheme builder newText: ''. textMorph hResizing: #spaceFill; borderWidth: 1. (UITheme builder newColumn: {textMorph}) openInWindow. textMorph contentsWrapped: 'Some text here Get a halo and inspect the text morph then use #contentsWrapped: to change text and see the results! #rigid hResizing also works.' Have fun! Regards, Gary ----- Original Message ----- From: "Tudor Girba" <[hidden email]> To: "Pharo Development" <[hidden email]> Sent: Sunday, August 21, 2011 11:57 PM Subject: [Pharo-project] expanding text morph Hi, I would like to create a Text Morph that wraps the text horizontally, and expands the height to fit the text. Thus, this morph would never offer scrolling. How could I do that? Cheers, Doru -- www.tudorgirba.com "There are no old things, there are only old ways of looking at them." |
Thanks, Gary!
And now the next question: If I place this one in a surrounding pane / expander / tab, how do I get the surrounding morph to resize when the text changes? Cheers, Doru On 22 Aug 2011, at 12:15, Gary Chambers wrote: > Hi Doru > > > |textMorph| > textMorph := UITheme builder newText: ''. > textMorph > hResizing: #spaceFill; > borderWidth: 1. > (UITheme builder newColumn: {textMorph}) openInWindow. > textMorph contentsWrapped: 'Some text here > > Get a halo and inspect the text morph > then use #contentsWrapped: to change text > > > and see the results! > > #rigid hResizing also works.' > > > > Have fun! > > Regards, Gary > > ----- Original Message ----- From: "Tudor Girba" <[hidden email]> > To: "Pharo Development" <[hidden email]> > Sent: Sunday, August 21, 2011 11:57 PM > Subject: [Pharo-project] expanding text morph > > > Hi, > > I would like to create a Text Morph that wraps the text horizontally, and expands the height to fit the text. Thus, this morph would never offer scrolling. > > How could I do that? > > Cheers, > Doru > > > -- > www.tudorgirba.com > > "There are no old things, there are only old ways of looking at them." > > > > > -- www.tudorgirba.com "Next time you see your life passing by, say 'hi' and get to know her." |
In the following example the expander resizes
|textMorph| textMorph := UITheme builder newText: ''. textMorph hResizing: #spaceFill; borderWidth: 1. (UITheme builder newColumn: { UITheme builder newExpander: 'One' for: textMorph. UITheme builder newExpander: 'Two' for: Morph new}) openInWindow. textMorph contentsWrapped: 'Some text here use #contentsWrapped: to change text' In general, if the surrounding morph has #shrinkWrap constraints then changes to the (minimum) dimensions of its submorphs will propagate resulting in a change of size for the surrounding morph. Regards, Gary ----- Original Message ----- From: "Tudor Girba" <[hidden email]> To: <[hidden email]> Sent: Tuesday, August 23, 2011 1:36 PM Subject: Re: [Pharo-project] expanding text morph Thanks, Gary! And now the next question: If I place this one in a surrounding pane / expander / tab, how do I get the surrounding morph to resize when the text changes? Cheers, Doru On 22 Aug 2011, at 12:15, Gary Chambers wrote: > Hi Doru > > > |textMorph| > textMorph := UITheme builder newText: ''. > textMorph > hResizing: #spaceFill; > borderWidth: 1. > (UITheme builder newColumn: {textMorph}) openInWindow. > textMorph contentsWrapped: 'Some text here > > Get a halo and inspect the text morph > then use #contentsWrapped: to change text > > > and see the results! > > #rigid hResizing also works.' > > > > Have fun! > > Regards, Gary > > ----- Original Message ----- From: "Tudor Girba" <[hidden email]> > To: "Pharo Development" <[hidden email]> > Sent: Sunday, August 21, 2011 11:57 PM > Subject: [Pharo-project] expanding text morph > > > Hi, > > I would like to create a Text Morph that wraps the text horizontally, and > expands the height to fit the text. Thus, this morph would never offer > scrolling. > > How could I do that? > > Cheers, > Doru > > > -- > www.tudorgirba.com > > "There are no old things, there are only old ways of looking at them." > > > > > -- www.tudorgirba.com "Next time you see your life passing by, say 'hi' and get to know her." |
Pretty cool!
Thanks, Doru On 24 Aug 2011, at 11:54, Gary Chambers wrote: > In the following example the expander resizes > > |textMorph| > textMorph := UITheme builder newText: ''. > textMorph > hResizing: #spaceFill; > borderWidth: 1. > (UITheme builder newColumn: { > UITheme builder newExpander: 'One' for: textMorph. > UITheme builder newExpander: 'Two' for: Morph new}) openInWindow. > > textMorph contentsWrapped: 'Some text here > use #contentsWrapped: to change text' > > In general, if the surrounding morph has #shrinkWrap constraints then changes to the (minimum) dimensions of its submorphs will propagate resulting in a change of size for the surrounding morph. > > Regards, Gary > > ----- Original Message ----- From: "Tudor Girba" <[hidden email]> > To: <[hidden email]> > Sent: Tuesday, August 23, 2011 1:36 PM > Subject: Re: [Pharo-project] expanding text morph > > > Thanks, Gary! > > And now the next question: > If I place this one in a surrounding pane / expander / tab, how do I get the surrounding morph to resize when the text changes? > > Cheers, > Doru > > > On 22 Aug 2011, at 12:15, Gary Chambers wrote: > >> Hi Doru >> >> >> |textMorph| >> textMorph := UITheme builder newText: ''. >> textMorph >> hResizing: #spaceFill; >> borderWidth: 1. >> (UITheme builder newColumn: {textMorph}) openInWindow. >> textMorph contentsWrapped: 'Some text here >> >> Get a halo and inspect the text morph >> then use #contentsWrapped: to change text >> >> >> and see the results! >> >> #rigid hResizing also works.' >> >> >> >> Have fun! >> >> Regards, Gary >> >> ----- Original Message ----- From: "Tudor Girba" <[hidden email]> >> To: "Pharo Development" <[hidden email]> >> Sent: Sunday, August 21, 2011 11:57 PM >> Subject: [Pharo-project] expanding text morph >> >> >> Hi, >> >> I would like to create a Text Morph that wraps the text horizontally, and expands the height to fit the text. Thus, this morph would never offer scrolling. >> >> How could I do that? >> >> Cheers, >> Doru >> >> >> -- >> www.tudorgirba.com >> >> "There are no old things, there are only old ways of looking at them." >> >> >> >> >> > > -- > www.tudorgirba.com > > "Next time you see your life passing by, say 'hi' and get to know her." > > > > > -- www.tudorgirba.com "We are all great at making mistakes." |
Ok, here comes a follow up question.
I would like now to have the morph in a tab, have the tab in the expander, and get this tab to resize when the inner text morph changes. I tried to make the tab shrinkWrap, but it does not seem to work there. Is it possible that this is a problem of the TabGroupMorph? Here is the code I used: textMorph := UITheme builder newText: ''. textMorph hResizing: #spaceFill; borderWidth: 1; unlock. tabs := TabGroupMorph new. tabs vResizing: #shrinkWrap; hResizing: #spaceFill; addPage: textMorph label: 'Tab'. tabs selectedPageIndex: 1. (UITheme builder newColumn: { UITheme builder newExpander: 'One' for: tabs. UITheme builder newExpander: 'Two' for: Morph new}) openInWindow. textMorph contentsWrapped: 'Some text here use #contentsWrapped: to change text' Cheers, Doru On 25 Aug 2011, at 01:24, Tudor Girba wrote: > Pretty cool! > > Thanks, > Doru > > > On 24 Aug 2011, at 11:54, Gary Chambers wrote: > >> In the following example the expander resizes >> >> |textMorph| >> textMorph := UITheme builder newText: ''. >> textMorph >> hResizing: #spaceFill; >> borderWidth: 1. >> (UITheme builder newColumn: { >> UITheme builder newExpander: 'One' for: textMorph. >> UITheme builder newExpander: 'Two' for: Morph new}) openInWindow. >> >> textMorph contentsWrapped: 'Some text here >> use #contentsWrapped: to change text' >> >> In general, if the surrounding morph has #shrinkWrap constraints then changes to the (minimum) dimensions of its submorphs will propagate resulting in a change of size for the surrounding morph. >> >> Regards, Gary >> >> ----- Original Message ----- From: "Tudor Girba" <[hidden email]> >> To: <[hidden email]> >> Sent: Tuesday, August 23, 2011 1:36 PM >> Subject: Re: [Pharo-project] expanding text morph >> >> >> Thanks, Gary! >> >> And now the next question: >> If I place this one in a surrounding pane / expander / tab, how do I get the surrounding morph to resize when the text changes? >> >> Cheers, >> Doru >> >> >> On 22 Aug 2011, at 12:15, Gary Chambers wrote: >> >>> Hi Doru >>> >>> >>> |textMorph| >>> textMorph := UITheme builder newText: ''. >>> textMorph >>> hResizing: #spaceFill; >>> borderWidth: 1. >>> (UITheme builder newColumn: {textMorph}) openInWindow. >>> textMorph contentsWrapped: 'Some text here >>> >>> Get a halo and inspect the text morph >>> then use #contentsWrapped: to change text >>> >>> >>> and see the results! >>> >>> #rigid hResizing also works.' >>> >>> >>> >>> Have fun! >>> >>> Regards, Gary >>> >>> ----- Original Message ----- From: "Tudor Girba" <[hidden email]> >>> To: "Pharo Development" <[hidden email]> >>> Sent: Sunday, August 21, 2011 11:57 PM >>> Subject: [Pharo-project] expanding text morph >>> >>> >>> Hi, >>> >>> I would like to create a Text Morph that wraps the text horizontally, and expands the height to fit the text. Thus, this morph would never offer scrolling. >>> >>> How could I do that? >>> >>> Cheers, >>> Doru >>> >>> >>> -- >>> www.tudorgirba.com >>> >>> "There are no old things, there are only old ways of looking at them." >>> >>> >>> >>> >>> >> >> -- >> www.tudorgirba.com >> >> "Next time you see your life passing by, say 'hi' and get to know her." >> >> >> >> >> > > -- > www.tudorgirba.com > > "We are all great at making mistakes." > > > > > > > -- www.tudorgirba.com "Be rather willing to give than demanding to get." |
Hi Doru.
When adding a page to a tab group the morph has its h/v resizing set to #spaceFill, so needs resetting after addding: textMorph := UITheme builder newText: ''. textMorph borderWidth: 1; unlock. tabs := TabGroupMorph new. tabs vResizing: #shrinkWrap; hResizing: #spaceFill; addPage: textMorph label: 'Tab'. tabs selectedPageIndex: 1. textMorph vResizing: #shrinkWrap. "or #rigid will do" (UITheme builder newColumn: { UITheme builder newExpander: 'One' for: tabs. UITheme builder newExpander: 'Two' for: Morph new}) openInWindow. textMorph contentsWrapped: 'Some text here use #contentsWrapped: to change text' Regards, Gary ----- Original Message ----- From: "Tudor Girba" <[hidden email]> To: "Pharo Development" <[hidden email]> Sent: Thursday, August 25, 2011 1:15 AM Subject: Re: [Pharo-project] expanding text morph Ok, here comes a follow up question. I would like now to have the morph in a tab, have the tab in the expander, and get this tab to resize when the inner text morph changes. I tried to make the tab shrinkWrap, but it does not seem to work there. Is it possible that this is a problem of the TabGroupMorph? Here is the code I used: textMorph := UITheme builder newText: ''. textMorph hResizing: #spaceFill; borderWidth: 1; unlock. tabs := TabGroupMorph new. tabs vResizing: #shrinkWrap; hResizing: #spaceFill; addPage: textMorph label: 'Tab'. tabs selectedPageIndex: 1. (UITheme builder newColumn: { UITheme builder newExpander: 'One' for: tabs. UITheme builder newExpander: 'Two' for: Morph new}) openInWindow. textMorph contentsWrapped: 'Some text here use #contentsWrapped: to change text' Cheers, Doru On 25 Aug 2011, at 01:24, Tudor Girba wrote: > Pretty cool! > > Thanks, > Doru > > > On 24 Aug 2011, at 11:54, Gary Chambers wrote: > >> In the following example the expander resizes >> >> |textMorph| >> textMorph := UITheme builder newText: ''. >> textMorph >> hResizing: #spaceFill; >> borderWidth: 1. >> (UITheme builder newColumn: { >> UITheme builder newExpander: 'One' for: textMorph. >> UITheme builder newExpander: 'Two' for: Morph new}) openInWindow. >> >> textMorph contentsWrapped: 'Some text here >> use #contentsWrapped: to change text' >> >> In general, if the surrounding morph has #shrinkWrap constraints then >> changes to the (minimum) dimensions of its submorphs will propagate >> resulting in a change of size for the surrounding morph. >> >> Regards, Gary >> >> ----- Original Message ----- From: "Tudor Girba" <[hidden email]> >> To: <[hidden email]> >> Sent: Tuesday, August 23, 2011 1:36 PM >> Subject: Re: [Pharo-project] expanding text morph >> >> >> Thanks, Gary! >> >> And now the next question: >> If I place this one in a surrounding pane / expander / tab, how do I get >> the surrounding morph to resize when the text changes? >> >> Cheers, >> Doru >> >> >> On 22 Aug 2011, at 12:15, Gary Chambers wrote: >> >>> Hi Doru >>> >>> >>> |textMorph| >>> textMorph := UITheme builder newText: ''. >>> textMorph >>> hResizing: #spaceFill; >>> borderWidth: 1. >>> (UITheme builder newColumn: {textMorph}) openInWindow. >>> textMorph contentsWrapped: 'Some text here >>> >>> Get a halo and inspect the text morph >>> then use #contentsWrapped: to change text >>> >>> >>> and see the results! >>> >>> #rigid hResizing also works.' >>> >>> >>> >>> Have fun! >>> >>> Regards, Gary >>> >>> ----- Original Message ----- From: "Tudor Girba" <[hidden email]> >>> To: "Pharo Development" <[hidden email]> >>> Sent: Sunday, August 21, 2011 11:57 PM >>> Subject: [Pharo-project] expanding text morph >>> >>> >>> Hi, >>> >>> I would like to create a Text Morph that wraps the text horizontally, >>> and expands the height to fit the text. Thus, this morph would never >>> offer scrolling. >>> >>> How could I do that? >>> >>> Cheers, >>> Doru >>> >>> >>> -- >>> www.tudorgirba.com >>> >>> "There are no old things, there are only old ways of looking at them." >>> >>> >>> >>> >>> >> >> -- >> www.tudorgirba.com >> >> "Next time you see your life passing by, say 'hi' and get to know her." >> >> >> >> >> > > -- > www.tudorgirba.com > > "We are all great at making mistakes." > > > > > > > -- www.tudorgirba.com "Be rather willing to give than demanding to get." |
Free forum by Nabble | Edit this page |