Write (rubric) text changes back to the object in GTInspector
Hi, if one has an inspector extension that shows a textual iVar of an object representing code (using #rubricText, #pharoMethod or #pharoPlayground) as in this example: gtInspectorSourceIn: composite <gtInspectorPresentationOrder: 30> ^ composite pharoMethod title: 'Source'; smalltalkClass: [ self methodClass ]; display: [ self getSource ]; act: [ self browse ] icon: GLMUIThemeExtraIcons glamorousBrowse entitled: 'Browse' What is the best/correct way to set the iVar when the text is typed so the state of the iVar represents the lively editing in the inspector extension? Or is there a way to realize this somehow with Glamour ports using the #text port? Thanks T.
Hi, You can try this: composite := GLMCompositePresentation new. composite pharoPlayground title: 'Script'; variableBindings: [ { #x -> 1. #y -> 2 } ]. composite openOn: 'x+y'. For the moment only script presentations can have variables. Btw #pharoPlayground and #rubricText will be deprecated in the latest version in favour of #pharoScript and #text Cheers, Andrei On Fri, Oct 30, 2015 at 11:14 AM, Torsten Bergmann <astares@gmx.de> wrote:
Hi,
if one has an inspector extension that shows a textual iVar of an object representing code (using #rubricText, #pharoMethod or #pharoPlayground) as in this example:
gtInspectorSourceIn: composite <gtInspectorPresentationOrder: 30> ^ composite pharoMethod title: 'Source'; smalltalkClass: [ self methodClass ]; display: [ self getSource ]; act: [ self browse ] icon: GLMUIThemeExtraIcons glamorousBrowse entitled: 'Browse'
What is the best/correct way to set the iVar when the text is typed so the state of the iVar represents the lively editing in the inspector extension?
Or is there a way to realize this somehow with Glamour ports using the #text port?
Thanks T.
2015-10-30 16:32 GMT+01:00 Andrei Chis <chisvasileandrei@gmail.com>:
Hi,
You can try this:
composite := GLMCompositePresentation new. composite pharoPlayground title: 'Script'; variableBindings: [ { #x -> 1. #y -> 2 } ]. composite openOn: 'x+y'.
For the moment only script presentations can have variables.
Btw #pharoPlayground and #rubricText will be deprecated in the latest version in favour of #pharoScript and #text
Cheers, Andrei
On Fri, Oct 30, 2015 at 11:14 AM, Torsten Bergmann <astares@gmx.de> wrote:
Hi,
if one has an inspector extension that shows a textual iVar of an object representing code (using #rubricText, #pharoMethod or #pharoPlayground) as in this example:
gtInspectorSourceIn: composite <gtInspectorPresentationOrder: 30> ^ composite pharoMethod title: 'Source'; smalltalkClass: [ self methodClass ]; display: [ self getSource ]; act: [ self browse ] icon: GLMUIThemeExtraIcons glamorousBrowse entitled: 'Browse'
What is the best/correct way to set the iVar when the text is typed so the state of the iVar represents the lively editing in the inspector extension?
Or is there a way to realize this somehow with Glamour ports using the #text port?
you can define an action on a port change: onChangeOfPort:act: | browser morph | morph := StringMorph new openInWorld. morph font:(LogicalFont familyName: 'Source Code Pro' pointSize: 30). browser := GLMTabulator new. browser row: #main. (browser transmit) to: #main; andShow: [ :a | a rubricText onChangeOfPort: #text act: [ :text | morph contents:text text] ]. ^ browser openOn:'type some text' This will open a StringMorph and a GlamourBrowser. If you change the text in the browser, it will change the contents of the string morph.
Thanks T.
Ahh. I think I misunderstood your question :) On Oct 30, 2015 11:48 AM, "Nicolai Hess" <nicolaihess@gmail.com> wrote:
2015-10-30 16:32 GMT+01:00 Andrei Chis <chisvasileandrei@gmail.com>:
Hi,
You can try this:
composite := GLMCompositePresentation new. composite pharoPlayground title: 'Script'; variableBindings: [ { #x -> 1. #y -> 2 } ]. composite openOn: 'x+y'.
For the moment only script presentations can have variables.
Btw #pharoPlayground and #rubricText will be deprecated in the latest version in favour of #pharoScript and #text
Cheers, Andrei
On Fri, Oct 30, 2015 at 11:14 AM, Torsten Bergmann <astares@gmx.de> wrote:
Hi,
if one has an inspector extension that shows a textual iVar of an object representing code (using #rubricText, #pharoMethod or #pharoPlayground) as in this example:
gtInspectorSourceIn: composite <gtInspectorPresentationOrder: 30> ^ composite pharoMethod title: 'Source'; smalltalkClass: [ self methodClass ]; display: [ self getSource ]; act: [ self browse ] icon: GLMUIThemeExtraIcons glamorousBrowse entitled: 'Browse'
What is the best/correct way to set the iVar when the text is typed so the state of the iVar represents the lively editing in the inspector extension?
Or is there a way to realize this somehow with Glamour ports using the #text port?
you can define an action on a port change: onChangeOfPort:act:
| browser morph | morph := StringMorph new openInWorld. morph font:(LogicalFont familyName: 'Source Code Pro' pointSize: 30). browser := GLMTabulator new. browser row: #main. (browser transmit) to: #main; andShow: [ :a | a rubricText onChangeOfPort: #text act: [ :text | morph contents:text text] ].
^ browser openOn:'type some text'
This will open a StringMorph and a GlamourBrowser. If you change the text in the browser, it will change the contents of the string morph.
Thanks T.
#onChangeOfPort:act: solved the problem. Thanks a lot! BTW: would be cool if you both could join Pharo on Slack.
Cool example. I slightly modified it and added it to the glamour examples :) | browser morph | morph := StringMorph new. morph font:(LogicalFont familyName: 'Source Code Pro' pointSize: 30). browser := GLMTabulator new. browser row: #main; row: #preview. browser transmit to: #main; andShow: [ :a | a text onChangeOfPort: #text act: [ :text | morph contents:text text] ]. browser transmit to: #preview; andShow: [ :a | a morph title: 'Preview'; display: [ morph ] ]. ^ browser openOn: 'some text' On Fri, Oct 30, 2015 at 11:47 AM, Nicolai Hess <nicolaihess@gmail.com> wrote:
2015-10-30 16:32 GMT+01:00 Andrei Chis <chisvasileandrei@gmail.com>:
Hi,
You can try this:
composite := GLMCompositePresentation new. composite pharoPlayground title: 'Script'; variableBindings: [ { #x -> 1. #y -> 2 } ]. composite openOn: 'x+y'.
For the moment only script presentations can have variables.
Btw #pharoPlayground and #rubricText will be deprecated in the latest version in favour of #pharoScript and #text
Cheers, Andrei
On Fri, Oct 30, 2015 at 11:14 AM, Torsten Bergmann <astares@gmx.de> wrote:
Hi,
if one has an inspector extension that shows a textual iVar of an object representing code (using #rubricText, #pharoMethod or #pharoPlayground) as in this example:
gtInspectorSourceIn: composite <gtInspectorPresentationOrder: 30> ^ composite pharoMethod title: 'Source'; smalltalkClass: [ self methodClass ]; display: [ self getSource ]; act: [ self browse ] icon: GLMUIThemeExtraIcons glamorousBrowse entitled: 'Browse'
What is the best/correct way to set the iVar when the text is typed so the state of the iVar represents the lively editing in the inspector extension?
Or is there a way to realize this somehow with Glamour ports using the #text port?
you can define an action on a port change: onChangeOfPort:act:
| browser morph | morph := StringMorph new openInWorld. morph font:(LogicalFont familyName: 'Source Code Pro' pointSize: 30). browser := GLMTabulator new. browser row: #main. (browser transmit) to: #main; andShow: [ :a | a rubricText onChangeOfPort: #text act: [ :text | morph contents:text text] ].
^ browser openOn:'type some text'
This will open a StringMorph and a GlamourBrowser. If you change the text in the browser, it will change the contents of the string morph.
Thanks T.
2015-10-30 19:30 GMT+01:00 Andrei Chis <chisvasileandrei@gmail.com>:
Cool example. I slightly modified it and added it to the glamour examples :)
| browser morph | morph := StringMorph new. morph font:(LogicalFont familyName: 'Source Code Pro' pointSize: 30). browser := GLMTabulator new. browser row: #main; row: #preview. browser transmit to: #main; andShow: [ :a | a text onChangeOfPort: #text act: [ :text | morph contents:text text] ]. browser transmit to: #preview; andShow: [ :a | a morph title: 'Preview'; display: [ morph ] ].
^ browser openOn: 'some text'
cool!
On Fri, Oct 30, 2015 at 11:47 AM, Nicolai Hess <nicolaihess@gmail.com> wrote:
2015-10-30 16:32 GMT+01:00 Andrei Chis <chisvasileandrei@gmail.com>:
Hi,
You can try this:
composite := GLMCompositePresentation new. composite pharoPlayground title: 'Script'; variableBindings: [ { #x -> 1. #y -> 2 } ]. composite openOn: 'x+y'.
For the moment only script presentations can have variables.
Btw #pharoPlayground and #rubricText will be deprecated in the latest version in favour of #pharoScript and #text
Cheers, Andrei
On Fri, Oct 30, 2015 at 11:14 AM, Torsten Bergmann <astares@gmx.de> wrote:
Hi,
if one has an inspector extension that shows a textual iVar of an object representing code (using #rubricText, #pharoMethod or #pharoPlayground) as in this example:
gtInspectorSourceIn: composite <gtInspectorPresentationOrder: 30> ^ composite pharoMethod title: 'Source'; smalltalkClass: [ self methodClass ]; display: [ self getSource ]; act: [ self browse ] icon: GLMUIThemeExtraIcons glamorousBrowse entitled: 'Browse'
What is the best/correct way to set the iVar when the text is typed so the state of the iVar represents the lively editing in the inspector extension?
Or is there a way to realize this somehow with Glamour ports using the #text port?
you can define an action on a port change: onChangeOfPort:act:
| browser morph | morph := StringMorph new openInWorld. morph font:(LogicalFont familyName: 'Source Code Pro' pointSize: 30). browser := GLMTabulator new. browser row: #main. (browser transmit) to: #main; andShow: [ :a | a rubricText onChangeOfPort: #text act: [ :text | morph contents:text text] ].
^ browser openOn:'type some text'
This will open a StringMorph and a GlamourBrowser. If you change the text in the browser, it will change the contents of the string morph.
Thanks T.
participants (3)
-
Andrei Chis -
Nicolai Hess -
Torsten Bergmann