[Base] Access2base 1.1.0 RemoveItem ABORT

Discussions about using 3rd party extension with OpenOffice.org
Post Reply
gonzolo
Posts: 2
Joined: Wed Jan 28, 2015 2:10 pm

[Base] Access2base 1.1.0 RemoveItem ABORT

Post by gonzolo »

Hi all,
I'm using the method RemoveItem provided in Access2base 1.1.0 to clear listbox items.

Code: Select all

olb.RemoveItem(olb.ListIndex)
But when we have only one item left in the list box, and we want to delete it (to have an empty listbox) the function nicely aborts with the following error message:
Error #9 (Index out of defined range) occurred at line 694 in Control.RemoveItem
This looks like to be a resizing error of the item array that goes negative...

Any fix for this? Is there a way to clear directly the listbox items?
thank you!
LibreOffice 4.3.5.2 on Windows7
User avatar
MTP
Volunteer
Posts: 1620
Joined: Mon Sep 10, 2012 7:31 pm
Location: Midwest USA

Re: [Base] Access2base 1.1.0 RemoveItem ABORT

Post by MTP »

I suspect it's not possible to "delete" the last item in a listbox, maybe try instead replacing it with an empty string ("").
If you know from the start you're emptying the entire list, you can just replace the source array of the list box with an array of one item that holds an empty string; that would be quicker than removing the items one at a time.
OpenOffice 4.1.1 on Windows 10, HSQLDB 1.8 split database
JPL
Volunteer
Posts: 132
Joined: Fri Mar 30, 2012 3:14 pm

Re: [Base] Access2base 1.1.0 RemoveItem ABORT

Post by JPL »

Hello,

I'm the author of the bug ... :(
... and also of what sometimes works fine in Access2Base (?).

The concerned line in the software is

Code: Select all

ReDim Preserve vRowSource(0 To iCount - 1)
and this DOES NOT create an empty array when iCount = 0, as I maybe expected when I wrote this code.

I will prepare a patch that will be included, considering https://wiki.documentfoundation.org/ReleasePlan, probably in LO 4.3.7 and LO 4.4.1.
A correction has been pushed to LO 4.3.7 and LO 4.4.1. See https://wiki.documentfoundation.org/ReleasePlan for their availability.

Note that LO 4.4.0, which be was released recently in the next coming hours or days, will includes Access2Base 1.2.0. This is good news. Unfortunately it still includes above bug.

The workaround proposed by MTP looks smart to me, as soon as the control is not bound to a database field.

Sorry for the inconvenience.
Thanks for using Access2Base and helping me to make a better software. :super:

JPL
Last edited by JPL on Tue Feb 03, 2015 2:05 pm, edited 1 time in total.
Kubuntu 22.04 / LibO 24.2
Access2Base (LibO).
BaseDocumenter extension (LibO)
ScriptForge (LibO)
Documentation on https://help.libreoffice.org/latest/en- ... bPAR=BASIC
User avatar
karolus
Volunteer
Posts: 1234
Joined: Sat Jul 02, 2011 9:47 am

Re: [Base] Access2base 1.1.0 RemoveItem ABORT

Post by karolus »

LO4.4.0 is released since yesterday
4.4.0.png
Libreoffice 25.2… on Debian 13 (trixie) (on RaspberryPI5)
Libreoffice 25.8… flatpak on Debian 13 (Bookworm) (on RaspberryPI5)
gonzolo
Posts: 2
Joined: Wed Jan 28, 2015 2:10 pm

Re: [Base] Access2base 1.1.0 RemoveItem ABORT

Post by gonzolo »

Many thanks JPL for the bug fix and for the access2base extention. I think that's a very useful one. :bravo:

Thanks also to MTP for his suggestion.

Keep coding, guys!

:)
LibreOffice 4.3.5.2 on Windows7
User avatar
MTP
Volunteer
Posts: 1620
Joined: Mon Sep 10, 2012 7:31 pm
Location: Midwest USA

Re: [Base] Access2base 1.1.0 RemoveItem ABORT

Post by MTP »

gonzolo wrote:Thanks also to MTP for his her suggestion.
Fixed that for you ;)
Glad you found help in this thread!
OpenOffice 4.1.1 on Windows 10, HSQLDB 1.8 split database
Post Reply