• Hello View!! can I speak to your re-Presenter?

    From F Bek@21:1/5 to All on Mon Jan 18 07:43:25 2021
    Beginner's question,
    Dolphin Smalltalk 7.1.19

    Well, now that I have a pretty compact MPV, with a Model composed of a class, a subclass, and an abstract class on top, two corresponding Presenter classes, and an abstract Presenter on top, holding a single View servicing both model classes.

    I would like to access some of the View's Number/TextPresenters and even StaticText to vary their properties, and even hide/show them, depending on the calling model. 

    I understand that Presenter>>onViewAvailable would be the right place to add such code, but have no idea how to identify each component of the View in order to talk to them. All I've noticed however was that the View components have some sort of id
    number e.g. (16r100E8E) next to their class names and names.
      
    Thank you for reading and eventually answering.
    FB
    ___________________________________________

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From F Bek@21:1/5 to john.a...@gmail.com on Tue Jan 19 02:06:29 2021
    Thanks John, this is great. 
    Experimenting!
    Regards,
    FB
    ___________________________________________

    On Tuesday, January 19, 2021 at 11:40:42 AM UTC+2, john.a...@gmail.com wrote:
    Hi,

    Where a view is linked to a presenter (e.g. your Number/TextPresenters) you can just ask the presenter for its view, e.g.

    myNumberPresenter view disable

    Note you need to do this in your presenter's onViewOpened method rather than onViewAvailable, since the presenter and view are not yet linked at the point onViewAvailable is invoked.

    For views without a corresponding presenter (e.g. StaticText), if you name them in the View Composer (set their 'name' aspect to a String) you can look them up by that name, e.g.

    (self view viewNamed: 'myLabel') text: 'This is a label'

    Hope this helps.

    John
    On Monday, January 18, 2021 at 3:43:26 PM UTC, fbek...@gmail.com wrote:
    Beginner's question,
    Dolphin Smalltalk 7.1.19

    Well, now that I have a pretty compact MPV, with a Model composed of a class, a subclass, and an abstract class on top, two corresponding Presenter classes, and an abstract Presenter on top, holding a single View servicing both model classes.

    I would like to access some of the View's Number/TextPresenters and even StaticText to vary their properties, and even hide/show them, depending on the calling model.

    I understand that Presenter>>onViewAvailable would be the right place to add such code, but have no idea how to identify each component of the View in order to talk to them. All I've noticed however was that the View components have some sort of id
    number e.g. (16r100E8E) next to their class names and names.

    Thank you for reading and eventually answering.
    FB
    ___________________________________________

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From john.aspinall@gmail.com@21:1/5 to fbek...@gmail.com on Tue Jan 19 01:40:41 2021
    Hi,

    Where a view is linked to a presenter (e.g. your Number/TextPresenters) you can just ask the presenter for its view, e.g.

    myNumberPresenter view disable

    Note you need to do this in your presenter's onViewOpened method rather than onViewAvailable, since the presenter and view are not yet linked at the point onViewAvailable is invoked.

    For views without a corresponding presenter (e.g. StaticText), if you name them in the View Composer (set their 'name' aspect to a String) you can look them up by that name, e.g.

    (self view viewNamed: 'myLabel') text: 'This is a label'

    Hope this helps.

    John


    On Monday, January 18, 2021 at 3:43:26 PM UTC, fbek...@gmail.com wrote:
    Beginner's question,
    Dolphin Smalltalk 7.1.19

    Well, now that I have a pretty compact MPV, with a Model composed of a class, a subclass, and an abstract class on top, two corresponding Presenter classes, and an abstract Presenter on top, holding a single View servicing both model classes.

    I would like to access some of the View's Number/TextPresenters and even StaticText to vary their properties, and even hide/show them, depending on the calling model.

    I understand that Presenter>>onViewAvailable would be the right place to add such code, but have no idea how to identify each component of the View in order to talk to them. All I've noticed however was that the View components have some sort of id
    number e.g. (16r100E8E) next to their class names and names.

    Thank you for reading and eventually answering.
    FB
    ___________________________________________

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From F Bek@21:1/5 to F Bek on Tue Jan 19 02:37:24 2021
    Works like a charm! Thanks again John! _____________________________________________
    On Tuesday, January 19, 2021 at 12:06:30 PM UTC+2, F Bek wrote:
    Thanks John, this is great.
    Experimenting!
    Regards,
    FB
    ___________________________________________
    On Tuesday, January 19, 2021 at 11:40:42 AM UTC+2, john.a...@gmail.com wrote:
    Hi,

    Where a view is linked to a presenter (e.g. your Number/TextPresenters) you can just ask the presenter for its view, e.g.

    myNumberPresenter view disable

    Note you need to do this in your presenter's onViewOpened method rather than onViewAvailable, since the presenter and view are not yet linked at the point onViewAvailable is invoked.

    For views without a corresponding presenter (e.g. StaticText), if you name them in the View Composer (set their 'name' aspect to a String) you can look them up by that name, e.g.

    (self view viewNamed: 'myLabel') text: 'This is a label'

    Hope this helps.

    John
    On Monday, January 18, 2021 at 3:43:26 PM UTC, fbek...@gmail.com wrote:
    Beginner's question,
    Dolphin Smalltalk 7.1.19

    Well, now that I have a pretty compact MPV, with a Model composed of a class, a subclass, and an abstract class on top, two corresponding Presenter classes, and an abstract Presenter on top, holding a single View servicing both model classes.

    I would like to access some of the View's Number/TextPresenters and even StaticText to vary their properties, and even hide/show them, depending on the calling model.

    I understand that Presenter>>onViewAvailable would be the right place to add such code, but have no idea how to identify each component of the View in order to talk to them. All I've noticed however was that the View components have some sort of id
    number e.g. (16r100E8E) next to their class names and names.

    Thank you for reading and eventually answering.
    FB
    ___________________________________________

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)