ID:2655759
 
Resolved
Mouse operations on grid controls mistakenly copied the grid cell into the "control" argument. This also impacted new mouse macros.
BYOND Version:514.1543+
Operating System:Windows 10 Pro 64-bit
Web Browser:Chrome 84.0.4147.89
Applies to:Dream Seeker
Status: Resolved (514.1547)

This issue has been resolved.
Descriptive Problem Summary:
I have an interface window with two grids, when you place an object in the grid and click on it the effect isn't the same as clicking on it in a statpanel.
This includes control not returning as expected through Click() but various other functions that alter the grids content only work by clicking the object from a statpanel rather than a grid. (e.g. src << output(null,"alchemy.output1") works from the statpanel but not from the grid).


Numbered Steps to Reproduce Problem:
With the code snippet below clicking in the grid will return the position of the object in the grid (1,2,3 etc. in a list grid) where as clicking it from a stat panel will return the expected control.

Code Snippet (if applicable) to Reproduce Problem:
obj/Items/Resources
Spirit_Grass
icon_state="Spirit Grass"
Click(location,control,params)
..()
if(src in usr.contents)
usr << "Selected: [src]([control])"
if(usr.Alchemy)
if(!(src in usr.AlchemyIngredients))
usr.AlchemyIngredients+=src
usr.AlchemyGrid()
else
if((src in usr.AlchemyIngredients))
usr << output(null,"alchemy.grid2")
usr.AlchemyIngredients-=src
usr.AlchemyGrid()


Expected Results:
Clicking from the grid should function the same as clicking the object from the statpanel.

Actual Results:
output(null,"window.grid") doesn't clear the grid when clicking from the grid and Click(location,control,params) doesn't return [control] as a variable when clicking from the grid (it returns the position) but clicking from the statpanel works as expected.

Does the problem occur:
Every time? Or how often? Every Time
In other games? Y
In other user accounts? N/A
On other computers? Y

When does the problem NOT occur?
N/A

Did the problem NOT occur in any earlier versions? If so, what was the last version that worked?
Spevacus confirmed the problem doesn't occur in 513

Workarounds:
Using a statpanel rather than using a grid allows all of the functions to work as expected.</<>
I've gone ahead and made a minimal test case that narrows onto the problem. This appears to apply to both stat panels and grid controls.

Here's a copy of the code:

mob/Stat()
if(objects[1] != null) stat("Click this:", objects[1])

mob/verb
DoTheThing()
objects[1] = new/obj/thing
src << output(objects[1], "grid1:1,1")

var/list/objects[] = list(null)

obj/thing
name = "foobar"
Click(location,control,params)
..()
usr << "You clicked: [src.name]<br>Control clicked: [control]<br>---------"


Here's a link to the test case (ignore the parts where it says "animate bug" or whatever, I just adopted an old test case from NSBR): https://www.dropbox.com/sh/b0o9xnquh7ibw2b/ AADNyMX_ZTcN-TgfppJ222eGa?dl=0

Compile and run, and click the "DoTheThing" verb. The grid control should now have an object in it, and the stat panel should appear with the ability to click the object.

In 513, when you click the grid's object, then the stat panel's object, this returns:
You clicked: foobar
Control clicked: default.grid1
---------
You clicked: foobar
Control clicked: default.info1
---------

In 514, the same process returns:
You clicked: foobar
Control clicked: 1,1
---------
You clicked: foobar
Control clicked: Stats
---------

Which is the same result if you were to output the "location" argument instead of "control"
Lummox JR resolved issue with message:
Mouse operations on grid controls mistakenly copied the grid cell into the "control" argument. This also impacted new mouse macros.
Descriptive Problem Summary:
When you drag and drop things into a grid, the over_control var inside the MouseDrop() sometimes (Not sure if always) comes back as "" instead of what you expected.
Numbered Steps to Reproduce Problem:
Create a grid.

Create way to check the over_control of MouseDrop().

Make dragging objs into a grid output the over_control to see whats happening.

Drag obj to grid.

Notice the over_control seems to be blank.
Code Snippet (if applicable) to Reproduce Problem:
Download example project with problem here - https://filebin.net/ylohqqzebnc6uhdn


Expected Results:
For over_control to equal the name of the control, instead of being blank.
Actual Results:
Blank result from over_control
Does the problem occur:
Every time? Or how often? Not sure, seems to be every time.
In other games? All games, I believe.
In other user accounts? Happens on all accounts.
On other computers? Happens on all computers, I think.

When does the problem NOT occur?
In the stable version of Byond, it seems not to occur.
Did the problem NOT occur in any earlier versions? If so, what was the last version that worked?
Version 513.1542

Workarounds:
Revert versions. Not sure if there's anything else.