Date: prev next · Thread: first prev next last
2014 Archives by date, by thread · List index


Hi :)
I was just about to point out documentation at
https://wiki.documentfoundation.org/Documentation/Other_Documentation_and_Resources#Programmers
It's a 3rd party guide rather than one produced by the official
documentation team.  However, it's written by Andrew Pitonyak and he
has done work in the docs team.

I normally recommend that people read through that while waiting for
an answer from one of the experts but Andrew has already replied.
Also i think i have handed that link out before so you've probably
already tried to find something relevant in there (or done my usual
trick of posting first and then reaching for documentation)
Regards from
Tom :)



On 1 April 2014 14:05, Andrew Douglas Pitonyak <andrew@pitonyak.org> wrote:
Sadly, I do not have a definitive answer to your question, but I do have
some thoughts... (see inline)


On 04/01/2014 06:57 AM, Marion & Noel Lodge wrote:

Hi,

In opening my database accounting system, I trigger via the Form: When
loading event, a macro, (Sub Init()), containing the database
initialisation routines.

As the Form loads it displays the first record in the database, including
the account number.   To make things easier for the user, the Text
modified
event on the account number control, triggers a macro, (Sub AccName()),
that displays the account name.


And I assume that this is built into the form.


Sometimes the system has crashed because it seems that Sub AccName() has
fired before Sub Init() has finished.  (Sub AccName() depends on some of
the structures that Sub Init() sets up.)

Is it possible that both Subs are running in parallel or do they always
run
in series on a first come first served basis?


Warning: Speculation... So insert the following text before each statement
below:  "I am making a wild unsubstantiated guess that"

1. The form is populated before Init() finishes
2. AccName() is called as soon as text is pushed into the control.

So, if this is the case, then AccName may be called before Init() finishes.
If you really want to know if they run at the same time, you could do a not
so quick test and modify each routine so that the macro does something like
this:

Sub Init()
  Write current time to a file
  delay a second or two
  Do the work
  delay a second or two
  Write the current time to a file
End Sub

Use a different file for each subroutine, then compare the start and end
time to see if they overlap. You can probably get away with using a simple
print statement at the start and end.


If the latter, are there coding techniques that can be used to ensure that
Sub Init() always runs first?


If things run serially and AccName is called based on something done in
Init(), it may be possible that Init() cannot complete until after
AccName() finishes.


I suppose that another possibility is to set a "Global" variable such as
"InitComplete". set to false when Init() starts, and set to true when it
completes. Modify AccName to check for InitComplete. If things are serial,
then you may need to simply return. If not, then have AccName wait for a few
seconds and try again. If things are truly serial, then I would expect them
to fail every time, and they don't fail every time, so it is likely not the
case.



If the former, how can I ensure that Sub AccName() waits until Sub Init()
has finished?


Oh wait, see above! :-)



Can someone point me to any articles on this subject?

Thanks,

Noel
--
Noel Lodge
lodgemn@gmail.com


--
Andrew Pitonyak
My Macro Document: http://www.pitonyak.org/AndrewMacro.odt
Info:  http://www.pitonyak.org/oo.php



--
To unsubscribe e-mail to: users+unsubscribe@global.libreoffice.org
Problems?
http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be
deleted


-- 
To unsubscribe e-mail to: users+unsubscribe@global.libreoffice.org
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be deleted

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.