[Cuis-dev] How to extend BrowserWindow menus?
Mariano Montone
marianomontone at gmail.com
Mon Jul 1 11:21:45 PDT 2024
Just reporting that I've figured out how to extend the menus now :)
Mariano
El 5/6/24 a las 10:34, Mariano Montone escribió:
> Hi Juan,
>
> I'm looking at what you point, but I can't figure it out.
>
> The easiest way for me would be to see some example code.
>
> If you don't mind, here's what I'm trying to do:
>
> I've implemented a SearchBrowser tool in Cuis-Smalltalk-Tools. Now I
> would like to add a 'Search ...' menu item to the browser's category
> menu that simply calls SearchBrowserWindow class>>searchCategory:
> with the browser's currently selected category.
>
> Perhaps you can provide the code for that, I will take it from there
> for my other cases. And it may also help with validating your design.
>
> In any case, there's no rush, and thanks,
>
> Mariano
>
> El 5/6/24 a las 09:19, Juan Vuletich escribió:
>> Hi Mariano,
>>
>> I'm doing a big overhaul of the way to specify Menus and Keyboard
>> Shortcuts in Cuis. The objective is to make it more flexible and
>> nicer to use than DynamicMenuBuilder. It is extensible by third
>> parties, although this is not yet documented and there are not any
>> examples. See #at:registerMenuAndShortcutsSpecProvider:, or give me
>> another week or so until this stabilizes.
>>
>> For a specific case where the implementor of the menu item action is
>> neither the Window nor the Model, see the menu for the list of files
>> in FileList. In any case, what I'd do perhaps is to extend the window
>> menu with the new operations that require its state.
>>
>> Cheers,
>>
>> On 6/4/2024 5:05 PM, Mariano Montone via Cuis-dev wrote:
>>> After looking more deeply at the implementation of menus, etc, I
>>> think my problem may be a bit difficult to solve.
>>>
>>> So perhaps it is better to forget about this, I've got it more or
>>> less "solved" for my purposes.
>>>
>>> El 4/6/24 a las 12:30, Mariano Montone escribió:
>>>> Hello,
>>>>
>>>> I would like to extend BrowserWindow menus from my extension.
>>>>
>>>> I have code like this:
>>>>
>>>> MyExtension class>>systemCategoryMenuOptions
>>>>
>>>> ^ {
>>>> {
>>>> #itemGroup -> 10.
>>>> #itemOrder -> 10.
>>>> #label -> 'search...'.
>>>> #object -> self.
>>>> #selector -> #searchCategory:.
>>>> #icon -> #findIcon
>>>> } asDictionary.
>>>> }
>>>>
>>>> But I can't figure out how to access the Browser instance from the
>>>> #searchCategory: method in my extension class. I have no way of
>>>> passing it via #arguments: there either.
>>>>
>>>> It makes sense to be able to, as extensions will want to access the
>>>> current browser state (selected category, etc). Is there a
>>>> workaround for this?
>>>>
>>>> Also, if this is solvable, I will want to extend the class list
>>>> menu of the browser too. But it doesn't use DynamicMenuBuilder
>>>> anymore, it was dropped at some point. Could it be brought back?
>>>>
>>>> Thanks!
>>>>
>>>> Mariano
>>>>
>>
>>
More information about the Cuis-dev
mailing list