Cool VL Viewer forum

View unanswered posts | View active topics It is currently 2024-10-06 22:39:30



Reply to topic  [ 13 posts ]  Go to page 1, 2  Next
Search/filter in various floaters 
Author Message

Joined: 2011-09-27 11:18:31
Posts: 200
Reply with quote
Hello, Henri, and happy new year!

Is it possible to add a search/filter capability to various floaters? It would be extremely useful for Friends and Groups (because my memory fails me sometimes and only remember bits of them and not the whole thing) and for the Radar (because I work in crowded sims and it's hard to find people in it otherwise). It would also be useful in the LUA inventory folders to easily find things. I understand there is a type-ahead feature for all of them, but it's not the same as a search/filter capability where you write part of the word and it shows it for you.

If you don't want to hardcode it, maybe you could implement it through LUA? It would mean we'd have to make our own friends/groups/radar floaters, but it would still be something.

Thanks in advance!


2024-01-04 20:58:50
Profile

Joined: 2009-03-17 18:42:51
Posts: 5795
Reply with quote
Accepted. So far, for the next release you will get:

  • Filter input box (search_editor) added to Groups, Friends and Radar floaters.
  • New GetAgentGroups() and GetAgentFriends() Lua functions to get the list of your groups and friends. EDIT: also added GetRadarList(), for good measure...
  • New SetLuaFloaterInvFilter() Lua function to set the filter string for inventory panels in Lua floaters.
  • Added search_editor's support to Lua floaters.


2024-01-12 23:33:59
Profile WWW

Joined: 2011-09-27 11:18:31
Posts: 200
Reply with quote
THANK YOU!!! :D


2024-01-13 10:09:20
Profile

Joined: 2009-03-17 18:42:51
Posts: 5795
Reply with quote
Changes implemented in today's v1.32.0.6 release.

Here is an example of how to use the new search_editor UI element support to set the inventory_panel UI element filter in a custom Lua floater:

First, the floater definition (~/.secondlife/skins/default/xui/en-us/floater_lua_inventory.xml for Linux, or %AppData%\SecondLife\skins\default\xui\en-us\floater_lua_inventory.xml for Windows):
Code:
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<floater name="lua_floater_inventory" title="Inventory"
 can_close="true" can_drag_on_left="false" can_minimize="true" can_resize="true"
 width="284" height="400" min_width="284" min_height="400">
<search_editor name="searchedit1" font="SansSerifSmall" label="Type the search string here"
 lua_command="SetLuaFloaterInvFilter(GetFloaterName(),'inventory1',GetValue())"
 left="10" bottom_delta="-36" height="18" width="264" follows="left|top" />
<inventory_panel name="inventory1" allow_multi_select="true" border="true" show_thumbnails="true"
 left="10" right="-10" top="-42" bottom="10" follows="left|top|right|bottom" />
</floater>

And an example command to use it (with the code to set up the search editor callback). EDIT: callback is now set via the new lua_command attribute (see in the XUI definition above), introduced with v1.32.0.7:
Code:
/lua OpenLuaFloater("inventory")


2024-01-20 11:27:22
Profile WWW

Joined: 2011-09-27 11:18:31
Posts: 200
Reply with quote
Perfect! I can't thank you enough <3


2024-01-20 14:59:42
Profile

Joined: 2016-06-19 21:33:37
Posts: 383
Location: Columbus area, OH, USA
Reply with quote
I have been experimenting with this new functionality. I really like it. Thank you. It's especially nice that the custom floater and filter will also bring back links. The standard inventory folder doesn't seem to do this.


2024-01-21 10:28:13
Profile

Joined: 2011-09-27 11:18:31
Posts: 200
Reply with quote
I have a little bug to report. Sometimes, but not all, when I type some letters on my lua inventory "Outfits" tab, I get an onslaught of messages in the console of the form
Code:
[10:55:12 PST]  Lua: Floater: inventoryOU - Control: inventory1 - Value:
[10:55:12 PST]  Lua: Floater: inventoryOU - Control: inventory1 - Value: 14f2a77e-a215-424e-ada1-aaefb5581f62
[10:55:12 PST]  Lua:   --> value #1 = 14f2a77e-a215-424e-ada1-aaefb5581f62

my FPS drop significantly (if I have the chat history on, due to the constant printing at a great speed, I suppose) and the floater will never return a result. I tried typing "loincloth".

Normally, if I type for example "green", the console will show me
Code:
[10:56:26 PST]  Lua: Opened floater: inventoryOU with parameter:
[10:56:26 PST]  Lua: Floater: inventoryOU - Control: inventory1 - Value: 14f2a77e-a215-424e-ada1-aaefb5581f62
[10:56:26 PST]  Lua:   --> value #1 = 14f2a77e-a215-424e-ada1-aaefb5581f62
[10:56:29 PST]  Lua: Floater: inventoryOU - Control: searchedit1 - Value: g
[10:56:30 PST]  Lua: Floater: inventoryOU - Control: searchedit1 - Value: gr
[10:56:30 PST]  Lua: Floater: inventoryOU - Control: searchedit1 - Value: gre
[10:56:30 PST]  Lua: Floater: inventoryOU - Control: searchedit1 - Value: gree
[10:56:30 PST]  Lua: Floater: inventoryOU - Control: searchedit1 - Value: green

and the floater will restrict to items containing the word "green", as it should. It doesn't happen all the time, just sometimes. Was the world too long? I don't know. I tried "averylongword" (it should return nothing) and it did it again :-S

The floater is
Code:
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<floater name="lua_floater_inventoryOU" title="Outfits"
can_close="true" can_drag_on_left="false" can_minimize="true" can_resize="true"
width="284" height="400" min_width="284" min_height="400">
<search_editor name="searchedit1" font="SansSerifSmall" label="Type the search string here"
left="10" bottom_delta="-36" height="18" width="264" follows="left|top" />
<inventory_panel name="inventory1" allow_multi_select="true" border="true"
left="10" right="-10" top="-42" bottom="10" follows="left|top|right|bottom" />
</floater>

and it's called with
Code:
SideBarButton(5, "inv_folder_bodypart.tga", "OpenLuaFloater('inventoryOU');SetLuaFloaterValue('inventoryOU','inventory1','Outfits');SetLuaFloaterCommand('inventoryOU','searchedit1','SetLuaFloaterInvFilter([[inventoryOU]],[[inventory1]],GetValue())')", "Outfits")


2024-01-23 19:55:32
Profile

Joined: 2009-03-17 18:42:51
Posts: 5795
Reply with quote
g0rd0ngrfr33mailgr wrote:
I have a little bug to report. Sometimes, but not all, when I type some letters on my lua inventory "Outfits" tab, I get an onslaught of messages in the console of the form
Err... Why are you making Lua print the selection in the chat ?... Do you really need this, or did just you copy and paste the example code (which is just a way to demonstrate how the callback works but got no practical purpose) for OnLuaFloaterAction() in the Lua manual ?
The OnLuaFloaterAction() callback is not even necessary, if you do not need to perform complex tasks on UI elements commit, and can instead do it all with SetLuaFloaterCommand(). You can also filter on UI floater or UI element name in the callback to exit it sooner (and avoid watchdog timeouts) for things you do not care about (e.g. with if control == "inventory1" then return end inserted at the start of the callback, if you do not need to take specific action on inventory items selection but just use the inventory UI element for its own context menu actions).

g0rd0ngrfr33mailgr wrote:
my FPS drop significantly (if I have the chat history on, due to the constant printing at a great speed, I suppose) and the floater will never return a result. I tried typing "loincloth".
The problem, here, is that the callback will be called for each matching inventory item, so the printing in the chat for each callback will indeed slow down the viewer, and at some point, the Lua watchdog will trigger to prevent an excessive slow down.
If you do need the OnLuaFloaterAction() callback and do not want to see it called too frequently while filtering, you may also start the said filtering only after a significative enough number of characters have been typed in the search input line (meaning there will be much less matching items and much less callbacks): e.g. SetLuaFloaterCommand('inventoryOU','searchedit1','if #GetValue() > 2 then SetLuaFloaterInvFilter(GetFloaterName(),[[inventory1]],GetValue()) end') to set the filter only after the match string contains 3 or more characters (if #GetValue() > 2).

EDIT: in addition, for next release, and to avoid callback storms, I changed the inventory panel Lua callback logic to ignore callbacks not resulting from a user action (mouse button or keyboard key click).


2024-01-24 09:14:03
Profile WWW

Joined: 2011-09-27 11:18:31
Posts: 200
Reply with quote
Henri Beauchamp wrote:
Err... Why are you making Lua print the selection in the chat ?... Do you really need this, or did just you copy and paste the example code…?

I copied and pasted it (I'll remind you I'm not a programmer). Then I saw it prints the UUIDs of selected items and thought it might prove useful, because I plan to try making a replace-inventory-links script in the future (which is quite useful for me) and I thought it might come handy.

Quote:
The problem, here, is that the callback will be called for each matching inventory item, so the printing in the chat for each callback will indeed slow down the viewer, and at some point, the Lua watchdog will trigger to prevent an excessive slow down. If you do need the OnLuaFloaterAction() callback and do not want to see it called too frequently while filtering, you may also start the said filtering only after a significative enough number of characters have been typed in the search input line (meaning there will be much less matching items and much less callbacks): e.g. SetLuaFloaterCommand('inventoryOU','searchedit1','if #GetValue() > 2 then SetLuaFloaterInvFilter(GetFloaterName(),[[inventory1]],GetValue()) end') to set the filter only after the match string contains 3 or more characters (if #GetValue() > 2).

I understand. I'll try that, thank you.


2024-01-24 10:58:31
Profile

Joined: 2009-03-17 18:42:51
Posts: 5795
Reply with quote
With v1.32.0.7, beside the change to avoid callback storms when filtering an inventory panel, things got even simpler thanks to the new lua_command attribute support for Lua floaters XUI controls. See the edited post above.


2024-01-27 10:33:00
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 13 posts ]  Go to page 1, 2  Next

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software.