Greedquest / ListObject-WithEvents

Create a list-object events listener package
MIT License
2 stars 1 forks source link

Fix linefeed character #2

Open Greedquest opened 1 year ago

Greedquest commented 1 year ago

Repo uses LF not CRLF meaning .bas .cls files cannot be imported by VBE or RD. Need to use .gitattributes file to fix treatment.

Workaround execute the following two in powershell in the src directory of this repo to fix the newlines:

function Normalise{
param($file)
((Get-Content $file) -join "`r`n")  | Set-Content $file
}

And in the src directory

Get-ChildItem -File | ForEach-Object {Normalise $_.fullname}
sergeos commented 1 year ago

Ok. For the first in the example we need to replace Set MyTable to Set fooTableEvents For second, if we are delete some rows, and after adding value under rows we catch an error in DefaultCategoiser: изображение

Greedquest commented 1 year ago

@sergeos

For the first in the example we need to replace Set MyTable to Set fooTableEvents

I'm guessing you are referring to the README quickstart example. Thanks for the heads up - fixed in e97f37b

For second, if we are delete some rows, and after adding value under rows we catch an error in DefaultCategoiser

Yes I need to work on that, as the comment in the code suggests, the situation where multiple rows are added at once is not handled yet, same with multiple columns and multiple column names being changed. If you add one row at a time it should work. But that is on the TODO list. I just need to decide if, when several rows are added, I want to raise multiple "RowAppended" events or a single "RowsAppended" event. Not sure?

Thanks for testing my library!

sergeos commented 1 year ago

I just need to decide if, when several rows are added, I want to raise multiple "RowAppended" events or a single "Row_s_Appended" event. Not sure?

I think enough a simple event when added a row, no matter one or more.

Further, if we delete all rows through the context menu, and then the next time a value is added, the row_appended/row_inserted event does not fired. I think this is because ListObject.DataBoundRange is Nothing when has none of values in it.

Further, if we resize the border of the listobject (I think you know such a small triangle at the bottom right of the ListObject) , we also do not receive any event. Now, I am also currently using subclassing over shapes, maybe it will be helpful also in your project? See it here https://gist.github.com/sancarn/246c0bbe2c8ec35cb492865a9843e3c6 Maybe ListObject have same behavior as the Shape?

Thank you for sharing your fine project.

Greedquest commented 1 year ago

Further, if we resize the border of the listobject (I think you know such a small triangle at the bottom right of the ListObject) , we also do not receive any event. Now, I am also currently using subclassing over shapes, maybe it will be helpful also in your project? See it here gist.github.com/sancarn/246c0bbe2c8ec35cb492865a9843e3c6 Maybe ListObject have same behavior as the Shape?

@sergeos Resize, Move, and maybe OnSort/Filter are all on my todo list (Resize and Move I know can be done as I've drafted them previously).

Thanks for the link although that uses quite a different technique for shapes to tables they're not really comparable.

if we delete all rows through the context menu

Can you clarify I'm not sure what you mean. I was not aware you could remove every single row of a table leaving only the headers? If a single row is left this code should handle that edge case.

PS Can I check with you I have a new release https://github.com/Greedquest/ListObject-WithEvents/releases/tag/v0.1.0-alpha which includes a demo workbook can you recreate the issue in that? On the sheet called "ScratchSheet". I just put a table with randomly generated data for testing

sergeos commented 1 year ago

Now was error occurs изображение

Greedquest commented 1 year ago

Apologies I never got back to you. For that you need to add a reference to Rubberduck in Tools/References. Do you use that? www.github.com/rubberduck-vba/Rubberduck

If not then you can delete any of the code in modules that doesn't compile, they are just the testing modules and I should probably exclude them