• change menuitem text?

    From john c@21:1/5 to All on Fri Apr 10 08:41:43 2020
    hi all,

    i have a tab application. i would like to change one of the menubar items text when a tab change occurs. i have already overridden #onTabChanged:. in #onTabChanged: i have put the following development code in #onTabChanged: but it doesn't change the
    menubar item text.

    any ideas what i'm missing?

    john

    jcView := self view.
    jcMenuBar := jcView menuBar.
    jcItems := jcMenuBar items.
    jcMenuItem := jcItems at: 2.
    id := jcMenuItem id.
    jcMenuItem updateItem: 2 id: id text: 'Test'.
    jcView refreshContents.
    self halt.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From klausk@21:1/5 to All on Fri Apr 10 23:16:48 2020
    Am Freitag, 10. April 2020 17:41:44 UTC+2 schrieb john c:
    hi all,

    i have a tab application. i would like to change one of the menubar items text when a tab change occurs. i have already overridden #onTabChanged:. in #onTabChanged: i have put the following development code in #onTabChanged: but it doesn't change the
    menubar item text.

    any ideas what i'm missing?

    john

    jcView := self view.
    jcMenuBar := jcView menuBar.
    jcItems := jcMenuBar items.
    jcMenuItem := jcItems at: 2.
    id := jcMenuItem id.
    jcMenuItem updateItem: 2 id: id text: 'Test'.
    jcView refreshContents.
    self halt.

    Please take a look at MVP in general.
    Your solution will be implementing the menuitems "CommandDescription->command" in the standard method "queryCommand:" of your Presenter (Dialog).
    E.g.

    (#(jcMenuItemCommand) includes: aCommandQuery command) ifTrue:
    [
    ^aCommandQuery isEnabled: (self conditionForEnabled)
    ].

    This method is called frequently and checks for every command (MenuItem, Pushbutton, etc.).

    Cheers,
    Klaus

    P.S. stay well

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