7. Jun 2018 00:29 by [email protected] <mailto:[email protected]>:
> Am Dienstag, 5. Juni 2018, 14:08:38 CEST schrieb > [email protected]
> <mailto:[email protected]>> :
>> Hi,
>>
>> To help in tagging, I managed to make a script/widget that allowsto keep
>> track of recently used tags and recently used tag filters incomboboxes.
>> This means that the entire content of the combobox getsrearranged in
>> changed_callback so that the most recently used valuesits on the top and
>> earlier values get pushed downwards.
>>
>>
>> However, I had to struggle quite a while to find a solution to thefirst
>> problem in the title. When selecting a value from the comboboxthe
>> change_callback gets triggered twice. So I had to add a check forwhether
>> this is the 1st or 2nd time the callback gets triggered,because otherwise I
>> easily ended up in an endless loop… Because thecallback gets also triggered
>> when combobox.selected is setprogrammatically.
>>
>> Question 1: Is this by design? Would it be possible to make thecallback
>> trigger only once? Also, would it be possible to prevent thecallback being
>> triggered if the combobox.selected has been set fromscript?
>
> You have to block/unblock the callback. Grep the code, there are plenty of
> examples how that works.
I am very sorry, but that went far above newbie's little head. Isort of
understand that I may need to handle the situation where thecallback gets
re-triggered by my code, but I find it a bit weird thata callback should run
twice as standard.
Here is a super simple combo test where selecting an entry fromthe list
triggers the callback twice at least in my setup (DebianStretch + Darktable
2.4.3).
local dt = require "darktable"
local debug = require "darktable.debug"
test_combo = dt.new_widget("combobox") {
label = "test combo",
tooltip = "Select an entry from the list and check what gets logged",
editable = false,
changed_callback = function (widget)
dt.print_log("Combobox changed_callback invoked,
selected="..widget.selected.." value="..tostring(widget.value))
end
}
local values = {"Paris","London","Berlin","Rome","Moscow"}
for i,v in ipairs(values) do
test_combo[i] = v
end
dt.register_lib ("super_simple_combo_test",
"super simple combo box test", true, true,
{[dt.gui.views.lighttable] = {"DT_UI_CONTAINER_PANEL_RIGHT_CENTER", 500},},
test_combo, nil, nil)
>
>
>> Question 2: Is there a way to make text written into a comboboxnot to scale
>> with the size of the list? Now the text is almostinvisible if there are
>> less than 2 entries in the list and then growsto huge if the list is long.
>
> I am not sure what you mean. Please take a screenshot, upload them somewhere
> and put a link into your reply. Attachments tend to upset people.
Acknowledging the risk of upsetting the audience, I attach twotiny screenshots
of tiny text when entering text into an editablecombobox. The first is "aaa"
entered to an empty combobox,the second is "ccc" entered to a combobox having
twoprevious values. The more values on the list, the
larger the text. Once one presses enter and the item is added to thelist, the
text appears in normal size.
(By the way, when entering values to a dynamically built combobox,the callback
gets triggered only once. But as soon as one selects oneof the entries on the
list, it gets triggered twice).
With best regards,
alpestries (a newbie in many regards)
>
>
>> With best regards,
>>
>> alpestris (darktable newbie)
>
> Tobias
___________________________________________________________________________
darktable developer mailing list
to unsubscribe send a mail to [email protected]