Subject: Re: bug#69457: unable to place two menu-choice widgets on same line

From: [email-masked]
Date: Thu, 29 Feb 2024 11:37:35 +0100

hi mauro,

thanks a lot for your response.

On 2/29/24 01:17, Mauro Aranda wrote:
> Yes, you need to control the :format for the choices to accomplish this, at least.
> 
>> some example code i have:
>>
>> (defun lem-ui-return-item-widgets (list)
>>    "Return a list of item widgets for each item, a string, in LIST."
>>    (cl-loop for x in list
>>             collect `(choice-item :value ,x)))
> 
> So, how about adding something like:
> :format "%[%t%] "
> here?
> 
> Did you try that?

thanks a lot, this works. i see now i had been shedding tears fighting with the menu-choice :format, not realizing i needed to wrangle the children elements instead. glad i asked the widget expert. %v also seems to work here, right?
> 
>> (defun lem-ui-widget-format (str &optional binding)
>>    "Return a widget format string for STR, its name.
>> BINDING is a string of a keybinding to cycle the widget's value."
>>    (concat "%[" (propertize str
>>                             'face 'lem-ui-widget-face
>>                             'lem-tab-stop t)
>>            "%]: %v"
>>            binding))
>>
>> ;; then within a buffer display function:
>>   (widget-create 'menu-choice
>>                       :tag "Listing"
>>                       :value type
>>                       :args (lem-ui-return-item-widgets lem-listing-types)
>>                       :help-echo "Select a listing type"
>>                       :format (lem-ui-widget-format "Listing") ; "C-c C-c")
> 
> What's the intention with the "C-c C-c"? Could it go at the end of the :format suggestion I gave above?

yes, with the above :format it should work.

thanks again for chiming in and helping me out!

marty