why does msgbox not exit

I am writing a Database to catalog various picture that I have on my heard drive. I have made a form with various fields on it.

Here is the macro attached to the BirthCitieslst listbox.

    Sub pick_city_list
Dim oForm as Object
Dim countryText as string
Dim cityList as Object
Dim cityBox as Object
Dim oCountryList as Object
Dim oCountryBox as Object
Dim idebugCode as integer

REM Determine if the countrylist text box has a value

oForm = ThisComponent.DrawPage.Forms.GetByName("dsPhotoInfo")
oCountryBox = oForm.getByName("birthCountry")

IF oCountryBox.text <> "" THEN
			IF idebugCode = 1  OR idebugCode = 2 THEN
			IF idebugCode = 1 OR idebugCode = 2 THEN

Here is a url do download the database and some files and folders with pictures if you need to test ou what I mean

link text

I am only using MSGBOXES becasue I read somewhere online that ThisComponent cannot be used with the BASICIDE debugger. I I am falling back to the oldest method of debugging and using MSGBOXES becasuse I could not locate a PRINT() function in Libreoffice BASIC.

The problem comes when I run the form. I put focus on the BirthcCities list box and the MSGBOX come up but then pressing either the ok or cancel buttons does nothing. Even clicking the X in the upper right of the MSGBOX does nothing. I eventually have to press CTRL-ALT-DELETE to get to the Task Manger and end LibreOffice from there. I do not understand why EXIT SUB is not being executed.


Did mention in your last question that there is no reason not to use the BASICIDE debugger.

Also noted that using focus requires special attention. Here presents a good example. You have a list box that executes a macro when focus is received. So in the macro you have a message box which receives the focus, you make a choice on the message box and it closes. Once it closed, the list box receives focus and the macro is executed again. Loop!

Don’t use message box with receiving focus, or don’t use focus events with message box or use the IDE for debugging or use an object inspector (MRI or Xray - although possible lack of support for these).

That gives you some choices.

FYI print xxx is available in basic.

First Ratslinger let me thank you once again for your help. I feel like and idiot now for not realizing that by putting the macro to the lisbox’s focus event I was creating and endless loop.

Second what event should I associate the macro with. There does not seem to be a “down pointing arrow clicked” event for a listbox.

Third I have MRI and XRAY I just have not read through the docs yet to understand how to use them properly.

Fourth I recall seeing somewhere on the web that there was a LO BASIC Print() statement but from what I read that prints to a file and not to a console window. Am I wrong about that ?


For list box I typically use Item status changed

Try print "Hello" and yes there is printing to file. See → StarOffice_7_Basic_Programmers_Guide

Hi, @Shaba1

See here, a test file made in Calc.

Test file