Following line of code was used before : DataList.CellValueAt(row, kColCommand) = Mid(HP_TypeName(Val(DataList.CellValueAt(row, 7))), 4).Lowercase.ReplaceAll("", " “).Titlecase
Mid is deprecated and I should use Middle instead: DataList.CellValueAt(row, kColCommand) = HP_TypeName(Val(DataList.CellValueAt(row, 7))).Middle(4).Lowercase.ReplaceAll(”", " ").Titlecase
But this gives an error !
I changed the line by two lines and then it works : s = HP_TypeName(Val(DataList.CellValueAt(row, 7)))
DataList.CellValueAt(row, kColCommand) = s.Middle(4).Lowercase.ReplaceAll("_", " ").Titlecase
Why doesn’t it work anymore with one line of code as i did before ?
I don’t analyse all the code but you have Mid(4) replacing by Middle(4) . Be carrefull, it should be .Middle(3) as Mid consider first character at 1 when the first character is 0 for Middle .
Thanks for the replies. @Thomas : thanks for the tip.
I need to be attentive with my upgrade to XOJO 2020r2.1
Are there more items that changed from 1-based to 0-based ?
Is there somewhere a list ?
Ok, but the change from 1-to 0-based will always be due to a command change ?
Mid changes to middle
Instr changes to IndexOf
…
If the command stays the same there will be no change to 0-based ?
For example : NthField does not change, Left and Right do not change …
Yes, fortunately, our applications would have became very buggy if they changed the way instructions work without change their name.
Then to be clear, if you don’t change anything, all will work as before until Xojo deprecated the API1 instructions. But they explained it will be in a very long time (without telling what is a very long time).
do not found a page in the docs where they talks about every control start at 0; no more asking yourself if this is 0 or 1: the first index will always be 0.
That is what I wanted to say above (with far fewer words).
FWIW, I believe the examples of converting Joe Strouts libraries might help you a bit, as you can compare the old code with the new one. Overall the transition isn’t too complicated. 2 difficulties I saw:
Discipline to adhere to API2 everywhere in your code
Having to work with an older Xojo Version w/o API2 turns out to be “difficult” after a few weeks
Indeed, I started a new app in XOJO 2020r2.1 (API2).
When I returned working on my app in XOJO 2018r4 this was very “strange / difficult”.
That’s the reason why I started migrating my XOJO 2018r4 app to XOJO 2020r2.1.
As far as I could test, the app was directly working in XOJO 2020r2.1.
Now I like to solve all the “Deprecated” items.
A lot of work, but little by little …