Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Patch] Filtering for GUILists #2593

Closed
DorpsGek opened this issue Feb 1, 2009 · 3 comments
Closed

[Patch] Filtering for GUILists #2593

DorpsGek opened this issue Feb 1, 2009 · 3 comments
Labels
component: interface This is an interface issue flyspray This issue is imported from FlySpray (https://bugs.openttd.org/) patch from FlySpray This issue is in fact a Patch, but imported from FlySrpay

Comments

@DorpsGek
Copy link
Member

DorpsGek commented Feb 1, 2009

Roujin opened the ticket and wrote:

This patch adds Filtering functions to the GUIList class.

You can specify different callback functions that are used to decide if an item would be filtered out or not, much like the sort functions work. The pointer to those functions is given to the GUIList with SetFilterFuncs(..) similar to SetSortFuncs(..). If no Filter functions are specified and/or filtering is disabled with e.g. "SetFilterStatus(false)", nothing will be filtered.

To filter the GUIList, you have to manually call Filter(const char *filter_string), where filter_string is an optional string you can pass through to the callback function(s) to decide on an item. It is advised to call this right after (re)building the list, before sorting.

If an item is filtered out, it is currently just erased from the list, so to get back filtered out items (if e.g. the filtering conditions have changed), you need to rebuild the list.

---
Attached are two files, the first one (GUIList_filtering_base.diff) contains only the changes to the GUIList class to allow for filtering.
The second one (GUIList_filtering_content.diff) is an example application of the filtering in the online content window. It allows entering a keyword that the list is compared with and only items containing this keyword are displayed.

Attachments

Reported version: trunk
Operating system: All


This issue was imported from FlySpray: https://bugs.openttd.org/task/2593
@DorpsGek
Copy link
Member Author

DorpsGek commented Feb 1, 2009

Roujin wrote:

Uhm, some things I forgot to write:

  1. the second .diff needs to be applied together with the first one to work
  2. for the second diff, I changed the key one has to press to select the current item for download to RETURN, so it doesn't conflict with entering the filter string (where you may need space)

This comment was imported from FlySpray: https://bugs.openttd.org/task/2593#comment5476

@DorpsGek
Copy link
Member Author

DorpsGek commented Feb 1, 2009

Roujin wrote:

The above patches seemingly did not compile with gcc due to some bad duplicate names I chose. Here are new versions for both which hopefully also compile on gcc.

Attachments


This comment was imported from FlySpray: https://bugs.openttd.org/task/2593#comment5477

@DorpsGek
Copy link
Member Author

DorpsGek commented Feb 6, 2009

Rubidium closed the ticket.

Reason for closing: Implemented


This comment was imported from FlySpray: https://bugs.openttd.org/task/2593

@DorpsGek DorpsGek closed this as completed Feb 6, 2009
@DorpsGek DorpsGek added component: interface This is an interface issue flyspray This issue is imported from FlySpray (https://bugs.openttd.org/) patch from FlySpray This issue is in fact a Patch, but imported from FlySrpay labels Apr 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: interface This is an interface issue flyspray This issue is imported from FlySpray (https://bugs.openttd.org/) patch from FlySpray This issue is in fact a Patch, but imported from FlySrpay
Projects
None yet
Development

No branches or pull requests

1 participant