adding menu to a RBBrowser extension pane

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
J G
Reply | Threaded
Open this post in threaded view
|

adding menu to a RBBrowser extension pane

J G
Hi,

I managed to add an extension to RBBrowser for visualizing (using
Jun). It works as shown in attached picture . However I failed to add
a menu to the new pane. I have added a mainMenu on the class side and
have not made changes to rebuildMenus method on instance side. But the
menu would not show up when I right click anywhere on the extension
tab. I consulted the help system but haven't find a clue.
Any pieces of advice on this? Thanks a lot in advance!

Best Regards,

Jim G

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc

q1.png (72K) Download Attachment
q2.png (71K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: adding menu to a RBBrowser extension pane

Niall Ross
Dear Jim,
    in older VW's, you needed to do
            BrowserApplicationModel flushMenus
but in VW7.7 #flushMenus is obsolete:  having the right pragma at the
head of the #mainMenu method should be sufficient.

It could help if you showed the #mainMenu method (as source), and the
new tool selected in a browser.

Have you put a breakpoint in the #mainMenu method and verified that it
gets built in #buildTopLevelMenuFrom: with no errors?

          Yours faithfully
             Niall Ross

>Hi,
>
>I managed to add an extension to RBBrowser for visualizing (using
>Jun). It works as shown in attached picture . However I failed to add
>a menu to the new pane. I have added a mainMenu on the class side and
>have not made changes to rebuildMenus method on instance side. But the
>menu would not show up when I right click anywhere on the extension
>tab. I consulted the help system but haven't find a clue.
>Any pieces of advice on this? Thanks a lot in advance!
>
>Best Regards,
>
>Jim G
>  
>
>
> ------------------------------------------------------------------------
>
>
> ------------------------------------------------------------------------
>
>------------------------------------------------------------------------
>
>_______________________________________________
>vwnc mailing list
>[hidden email]
>http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
>  
>


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
J G
Reply | Threaded
Open this post in threaded view
|

Re: adding menu to a RBBrowser extension pane

J G
Dear Nill,

Sorry for a late reply since I've just seen your message.

I'm using VW 7.7 and I have used subcanvas in the new tool pane.
The mainMenu class method in my subclass of CodeTool  class is quite simple (some Chinese string has been replaced by English ones):

mainMenu
    "Tools.MenuEditor new openOnClass: self andSelector: #mainMenu"
    <resource: #menu>

    ^#(#{UI.Menu} #(#(#{UI.MenuItem}
        #rawLabel: 'selections'
        #value: #selections
        #submenu: #(#{UI.Menu} #(#(#{UI.MenuItem}
            #rawLabel: 'Daily'
            #value: #daily) #(#{UI.MenuItem}
            #rawLabel: 'Weekly'
            #value: #weekly) #(#{UI.MenuItem}
            #rawLabel: 'Monthly'
            #value: #monthly)) #(3) nil))) #(1) nil) decodeAsLiteralArray.

I just tried to add breakpoint in above method but it seems the mainMenu method has never been avoked.
Since I'm just doing experiments with VW it's all OK without a menu but I'm just curious.

The windowSpec method looks like:
windowSpec
    "Tools.UIPainter new openOnClass: self andSelector: #windowSpec"
    <resource: #canvas>

    ^#(#{UI.FullSpec}
        #window: #(#{UI.WindowSpec}
            #label: 'RBExperiment'
            #bounds: #(#{Graphics.Rectangle} 720 408 920 608)
            #toolBar: #mainMenu)
        #component: #(#{UI.SpecCollection}
            #collection: #(#(#{UI.SubCanvasSpec}
                #layout: #(#{Graphics.LayoutFrame} 0 0 0 0 0 1 0 1)
                #name: #SubcanvasJun
                #majorKey: #{RBExperiment.JunBrowserExpTool}
                #minorKey: #windowSpec
                #clientKey: #junBrowserExpTool)))).

Best Regards,

Jim G


On Mon, Jul 19, 2010 at 10:31 PM, Niall Ross <[hidden email]> wrote:
Dear Jim,
  in older VW's, you needed to do
          BrowserApplicationModel flushMenus
but in VW7.7 #flushMenus is obsolete:  having the right pragma at the head of the #mainMenu method should be sufficient.

It could help if you showed the #mainMenu method (as source), and the new tool selected in a browser.

Have you put a breakpoint in the #mainMenu method and verified that it gets built in #buildTopLevelMenuFrom: with no errors?

        Yours faithfully
           Niall Ross

Hi,

I managed to add an extension to RBBrowser for visualizing (using
Jun). It works as shown in attached picture . However I failed to add
a menu to the new pane. I have added a mainMenu on the class side and
have not made changes to rebuildMenus method on instance side. But the
menu would not show up when I right click anywhere on the extension
tab. I consulted the help system but haven't find a clue.
Any pieces of advice on this? Thanks a lot in advance!

Best Regards,

Jim G

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
 






_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: adding menu to a RBBrowser extension pane

Niall Ross
Dear Jim,

1) You can invoke the #mainMenu method either by putting a _one-shot_
breakpoint in the

rbExperimentToolClass
    <tool: 200>
    ^RBExperiment

method (or whatever similar one you have) or by sending
    BrowserApplicationModel instanceMethodsChanged
to invoke rebuildMenus on every RB.  Whichever you do, this will invoke
    codeModel: aCodeModel
        codeModel := aCodeModel.
        menu := self buildTopLevelMenuFrom: #mainMenu
on the tool.  The last line (re)builds and (re)caches the menu in the
tool's 'menu' instVar.  (In normal operation, the menu is rebuilt on
every invocation only if it satisfies #doesMenuNeedToBeRebuilt:.  
Otherwise it is rebuilt and recached only  when methods change.)

2) That gets the menu into instVar  'menu'.  The CodeTool>>menu and
BrowserTextTool>>textMenu accessors return it.  You then need to assign
it to the appropriate widget in the tool.  This can be done by adding a
#menu: line in the spec or by a call of #setMenu:for: (or #addPart: if
you want it in e.g. a menuBar).  Browse hierarchy senders of #textMenu
to see examples in the existing tools.

HTH
          Yours faithfully
             Niall Ross
   

> Dear Niall,
>
> Sorry for a late reply since I've just seen your message.
>
> I'm using VW 7.7 and I have used subcanvas in the new tool pane.
> The mainMenu class method in my subclass of CodeTool  class is quite
> simple (some Chinese string has been replaced by English ones):
>
> mainMenu
>     "Tools.MenuEditor new openOnClass: self andSelector: #mainMenu"
>     <resource: #menu>
>
>     ^#(#{UI.Menu} #(#(#{UI.MenuItem}
>         #rawLabel: 'selections'
>         #value: #selections
>         #submenu: #(#{UI.Menu} #(#(#{UI.MenuItem}
>             #rawLabel: 'Daily'
>             #value: #daily) #(#{UI.MenuItem}
>             #rawLabel: 'Weekly'
>             #value: #weekly) #(#{UI.MenuItem}
>             #rawLabel: 'Monthly'
>             #value: #monthly)) #(3) nil))) #(1) nil) decodeAsLiteralArray.
>
> I just tried to add breakpoint in above method but it seems the
> mainMenu method has never been avoked.
> Since I'm just doing experiments with VW it's all OK without a menu
> but I'm just curious.
>
> The windowSpec method looks like:
> windowSpec
>     "Tools.UIPainter new openOnClass: self andSelector: #windowSpec"
>     <resource: #canvas>
>
>     ^#(#{UI.FullSpec}
>         #window: #(#{UI.WindowSpec}
>             #label: 'RBExperiment'
>             #bounds: #(#{Graphics.Rectangle} 720 408 920 608)
>             #toolBar: #mainMenu)
>         #component: #(#{UI.SpecCollection}
>             #collection: #(#(#{UI.SubCanvasSpec}
>                 #layout: #(#{Graphics.LayoutFrame} 0 0 0 0 0 1 0 1)
>                 #name: #SubcanvasJun
>                 #majorKey: #{RBExperiment.JunBrowserExpTool}
>                 #minorKey: #windowSpec
>                 #clientKey: #junBrowserExpTool)))).
>
> Best Regards,
>
> Jim G
>
>
> On Mon, Jul 19, 2010 at 10:31 PM, Niall Ross <[hidden email]
> <mailto:[hidden email]>> wrote:
>
>     Dear Jim,
>       in older VW's, you needed to do
>               BrowserApplicationModel flushMenus
>     but in VW7.7 #flushMenus is obsolete:  having the right pragma at
>     the head of the #mainMenu method should be sufficient.
>
>     It could help if you showed the #mainMenu method (as source), and
>     the new tool selected in a browser.
>
>     Have you put a breakpoint in the #mainMenu method and verified
>     that it gets built in #buildTopLevelMenuFrom: with no errors?
>
>             Yours faithfully
>                Niall Ross
>
>         Hi,
>
>         I managed to add an extension to RBBrowser for visualizing (using
>         Jun). It works as shown in attached picture . However I failed
>         to add
>         a menu to the new pane. I have added a mainMenu on the class
>         side and
>         have not made changes to rebuildMenus method on instance side.
>         But the
>         menu would not show up when I right click anywhere on the
>         extension
>         tab. I consulted the help system but haven't find a clue.
>         Any pieces of advice on this? Thanks a lot in advance!
>
>         Best Regards,
>
>         Jim G
>
>         _______________________________________________
>         vwnc mailing list
>         [hidden email] <mailto:[hidden email]>
>         http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
>          
>
>
>
>
>
>


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc