PDA

View Full Version : Bug: Empty/CreateOnEmpty for Windowlist not visible when empty.



celestian
February 28th, 2020, 19:55
I've noticed a difference in the way windowlists work in FGC and FGU.

Left side is FGC, right side is FGU. Note the differences indicated.

https://i.imgur.com/RF7Woj4.png

Here is a snippet of the windowlist code for the "Sounds" (above "Random Sounds") in the New Trigger.


<!-- linked sounds -->
<windowlist name="sounds_list">
<frame>reference-section</frame>
<script>
function onDrop(x, y, draginfo)
if not WindowManager.getReadOnlyState(getDatabaseNode().g etParent()) then
if draginfo.isType("shortcut") then
local sClass, sRecord = draginfo.getShortcutData();
if sClass == 'audio' then
local node = getDatabaseNode().getParent();
if DB.getChildCount(node,"soundlist") &lt; 2 then
local nodeSounds = node.createChild("soundlist");
local nodeSound = nodeSounds.createChild();
if nodeSound then
local nodeSource = DB.findNode(sRecord);
local sName = DB.getValue(nodeSource,"name","");
DB.setValue(nodeSound,"sound","string",sRecord);
DB.setValue(nodeSound,"name","string",sName);
end
end
end
end
return true;
end
end
</script>
<anchored>
<top parent="sounds_label" anchor="bottom" offset="20" relation="relative" />
<left parent="" anchor="left" offset="5" />
<right parent="" anchor="right" relation="relative" offset="5" />
</anchored>
<child></child>
<child><backcolor>4040301E</backcolor></child>
<noscroll />
<empty textres="audiotriggers_label_dropsounds" />
<footer>footer_blank</footer>
<datasource>.soundlist</datasource>
<class>window_sound</class>
</windowlist>



Specifically the empty textres is not showing.

I also noticed that the "Matches" entry windowlist is not the same either. It should be creating a "blank" Match record when empty like the FGC version does.

Here is the xml snippet for that.



<windowlist name="matches_list">
<frame>reference-section</frame>
<anchored>
<top parent="match_label" anchor="bottom" offset="10" relation="relative" />
<left parent="" anchor="left" offset="5" />
<right parent="" anchor="right" relation="relative" offset="5" />
</anchored>
<child></child>
<child><backcolor>4040301E</backcolor></child>
<noscroll />
<empty textres="audiotriggers_label_addmatch" />
<createonempty />
<datasource>.matchlist</datasource>
<class>window_match</class>
</windowlist>

Moon Wizard
February 28th, 2020, 21:19
As we discussed on Discord, empty text for lists does not add to dynamic list height, so that needs to be accounted for using a minimum size tag. This is the same as FGC, main difference is footer option deprecated in FGU.

For the createonempty tag, I'll have to investigate. There is code in FGU, so it should work. Personally, I'm not a fan of that tag, since I don't like to auto-add records unless the user has requested a record.

Regards,
JPG

celestian
February 28th, 2020, 21:55
As we discussed on Discord, empty text for lists does not add to dynamic list height, so that needs to be accounted for using a minimum size tag. This is the same as FGC, main difference is footer option deprecated in FGU.


Incase anyone else wasn't aware what he is talking about is the anchored ability to have a <sizelimits> option. I never knew it existed and it works perfectly.



<anchored>
<sizelimits>
<minimum height="20" />
</sizelimits>
<top parent="randomsounds_label" anchor="bottom" offset="15" relation="relative" />
<left parent="" anchor="left" offset="5" />
<right parent="" anchor="right" relation="relative" offset="5" />
</anchored>


That makes sure the window is at least 20 high and ignores it if the windowlist makes it bigger.



For the createonempty tag, I'll have to investigate. There is code in FGU, so it should work. Personally, I'm not a fan of that tag, since I don't like to auto-add records unless the user has requested a record.


@Moon Wizard, I tend to agree on the adding a empty record but for this one case it needs to have one. Can't match on nothing for the triggers. I actually had coded a "create when no records" and noticed the option.

LordEntrails
February 28th, 2020, 23:02
Incase anyone else wasn't aware what he is talking about ...
We only pretend we have a clue!

damned
February 29th, 2020, 00:11
<sizelimits>
<minimum height="20" />
</sizelimits>

will be useful to me Im sure