Skip to content

Conversation

Dark-Dragon
Copy link
Contributor

@Dark-Dragon Dark-Dragon commented Feb 27, 2023

guiGridListSetItemText and guiGridListSetItemData can affect unintended rows when user-sorting is used in conjunction with the search-filter, causing the text or data to apply to an incorrect row and therefore disappear for the intended row with the current way admin2 refreshes the gridlists. In some cases it's a big deal, because it can cause the gridlist to malfunction until admin2 is reloaded. Rather than disabling user-sorting for all gridlists we can use the optional arguments of guiGridListAddRow wherever possible, and store, disable and re-apply the GUI property "SortDirection" for the remaining cases, to ensure proper application.

This pull request currently fixes the following GUI gridlists:

/client/main/admin_players.lua -> aPlayersTab.PlayerList
/client/main/admin_resources.lua -> aResourcesTab.ResourceList
/client/widgets/admin_interior.lua -> aInterior.List
/client/widgets/admin_skin.lua -> aSkin.List
/client/widgets/admin_team.lua -> aTeam.List
/client/widgets/admin_vehicle.lua -> aVehicle.List
/client/widgets/admin_weapon.lua -> aWeapon.List

Notably it's currently not changing these GUI gridlists:

/client/main/admin_acl.lua -> aAclTab.RightsTab (Benefit from changes would be diminished, as clearing all columns (which is done a lot here) circumvents the problem as well. Main remaining benefit would be to preserve user-sorting after input in the search-filter)
/client/main/admin_bans.lua -> aBansTab.BansList (Bans are currently a large WIP in another branch, so I decided to not change this one for now)

Three small additional fixes were made: one removing tabs in favor of 4 spaces to match coding style in admin_players.lua; fixed an incorrectly named setting to have admin2 remember the users sort vehicles by vehicle groups preference; and the team widget will now close correctly when assigning a player a team via double click.

See line comments on commits for more explanation.

admin2 : fixed spectator player action GUI buttons which were non-functional due to referring to global variable names from old admin.
fixed disappearing text and incorrectly displayed sections for aVehicle aWeapon and aSkin widget gridlists if the user used gridlist sorting; fixed incorrectly set aSetting used to remember 'sort by groups' for aVehicle; unified .Refresh function for aVehicle and aSkin to match aWeapon
fixed disappearing text in players and resources tab gridlist if the user used gridlist sorting and search filter; unified player search to match the filter structure and method used in widgets; fixed selected player being unselected when using search filter
changed tabs to 4 spaces to match coding style
fixed disappearing text in interiors widget gridlist and incorrect team color and team data application in teams widget gridlist when gridlist is user-sorted in conjunction with search-filter
fixed team widget not closing when assigning a team via double click
@Dark-Dragon Dark-Dragon marked this pull request as ready for review March 3, 2023 06:21
@jlillis
Copy link
Contributor

jlillis commented Apr 19, 2023

Looks good from my testing, nice work.

@jlillis jlillis merged commit e0d1642 into multitheftauto:master Apr 19, 2023
@Dark-Dragon Dark-Dragon deleted the admin2-dragon's-fixes branch April 20, 2023 20:21
@patrikjuvonen patrikjuvonen added this to the 1.6.0 milestone Jun 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants