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


Hi :)
That looks better to me.  I'm not a programmer and don't understand code but it looks like a lot 
less lines and hopefully that results in faster execution of the code.  So more cpu cycles for the 
actual processing and less used up in the overhead of producing the timer-indicator.  

Good work! :)
Regards from
Tom :)  





________________________________
From: "mcmurchy1917-libreoffice@yahoo.co.uk" <mcmurchy1917-libreoffice@yahoo.co.uk>
To: users@global.libreoffice.org 
Sent: Monday, 25 March 2013, 11:19
Subject: Re: [libreoffice-users] Changing The Mouse Cursor to an HourGlass

I've now dropped the dialog and ProgressBar in favour of the status bar with 


REM Create a NEW status indicator
oBar = document.createStatusIndicator()
oBar.start("Started...", rsSUBSCRIBERS.Row() + 3)
oBar.Value = 1 ' show  progress bar
Bar.Text = "Progressing..."

Then each time the MailMergeListener is triggered I do this 

Sub MailMergeListener_notifyMailMergeEvent( oEv As Object )
    
cursorWait
    ProgressValue = ProgressValue + 1
    oBar.Value = ProgressValue
    
End Sub


Iain


On Monday 25 Mar 2013 09:59:20 mcmurchy1917-libreoffice@yahoo.co.uk wrote:
Hi Andrew

I had read the document and had hoped this might have changed. From a
professional point of view some customers dictate that a mouse pointer must
be changed to a hour glass if an action cannot be completed in a
pre-determined amount of time.


So anyway, I've done a belts and braces job for now


added a MailMergeEventListener which gets triggered each time the Mail Merge
routine processes another row so my block of code looks like -



oMailMerge = CreateUnoService("com.sun.star.text.MailMerge")
oMailMerge.DocumentURL =  ConvertToUrl(DirectoryName & "/" & "nwcircMaster"
& ".odt")
oMailMerge.DataSourceName =  "NWcirculation"
oMailMerge.CommandType = 1
'oMailMerge.Command = "qrySUBSCRIBERS"
oMailMerge.Command = "Query_SUBSCRIBERS_For_Wrappers"
oMailMerge.OutputType = com.sun.star.text.MailMergeType.FILE
oMailMerge.OutputUrl = ConvertToUrl(DirectoryName)
oMailMerge.FileNamePrefix = sColour & "Merged"
oMailMerge.SaveAsSingleFile=True
oMailMerge.FileNameFromColumn=False
oMailMerge.Filter="COLOUR='" & sColour & "'"
oListener1 = createUNOListener("MailMergeListener_",
"com.sun.star.text.XMailMergeListener")
oMailMerge.addMailMergeEventListener(oListener1)
oMailMerge.execute(Array())


added these two subroutines and a dialog with a progress bar. The dialog is
shown just before the mail merge process starts and the progress bar
increments each time the merge completes another row -


Sub MailMergeListener_notifyMailMergeEvent( oEv As Object )

    cursorWait
    ProgressValue = ProgressValue + 1
    oProgressBarModel.setPropertyValue( "ProgressValue", ProgressValue )

End Sub

Sub MailMergeListener_disposing()

End Sub

Seems to work quite nicely, though I would like to drop the title bar of the
dialog so all the user sees is the incrementing progress bar.


Note that in the subroutine, MailMergeListener_notifyMailMergeEvent, I've
got a call to another subroutine called cursorWait which is -

Sub cursorWait()
    Dim oWindow As Object
    Dim oPointer As Object

    oWindow = ThisComponent.CurrentController.Frame.ComponentWindow window
    oPointer = createUnoService("com.sun.star.awt.Pointer")
    oPointer.SetType(com.sun.star.awt.SystemPointer.WAIT)
    changeMousePointerRecursively(oPointer, oWindow)

End sub

sub changeMousePointerRecursively(oMousePointer as object, oWin as object)
on error resume next

    oWin.setPointer(oMousePointer)

    if HasUnoInterfaces(oWin, "com.sun.star.awt.XVclContainer") then
             oWindows = oWin.Windows
             for k=0 to UBound(oWindows)
                   call changeMousePointerRecursively(oMousePointer,
oWindows(k))
             next k
       endif

end sub


With the above, the pointer is presented as an hourglass most of the time,
occasionally it changes to the Text Insert shape but then quickly reverts
back to the hourglass. I did try listening on the MouseMotionListener and
placing a call to cursorWait there but when there was excessive movement of
the mouse the application ground to a halt, but then if a user is randomly
moving the mouse whilst the application is running they may deserve a slow
running application!

Any other suggestions gratefully received.

Iain

On Sunday 24 Mar 2013 18:04:30 Andrew Douglas Pitonyak wrote:
Read section "5.21.  Changing The Mouse Cursor" in AndrewMacro.odt,
which discusses this topic. It begins as follows:

The quick answer is: This is not supported.

A desire to change the mouse cursor sparked an interesting discussion
that I took the time to follow but I did not test. I have edited the
messages for brevity.

.....

Includes who said what with example code.

On 03/21/2013 01:31 PM, mcmurchy1917-libreoffice@yahoo.co.uk wrote:
Hi All

I've built a database, using Base, which amongst other things produces a
mailing list. On my 10 year old DeskTop it can take several minutes to
produce the list.

I want to show some activity to the users, so the mouse cursor morphing
into an HourGlass would suit me fine.

I've got this to work as long as I don't move the mouse. The code is -


oFrame = StarDesktop.CurrentFrame
oWindow = oFrame.getContainerWindow()

oPointer = createUnoService("com.sun.star.awt.Pointer")
oPointer.SetType(com.sun.star.awt.SystemPointer.WAIT)
oWindow.setPointer(oPointer)


However, If I move the mouse the cursor reverts back to the appropriate
style for the control which it is over.

From several discussions there seems to be an indication that I need to

disable the mousemotionlisteners. In going any further I seem to have
hit
a
brick wall.

Can anyone advise what I should do to keep the cursor displaying the
hourglass during the duration of a task irrespective as the whether the
mouse moves or not.


Thanks

-- 
For unsubscribe instructions e-mail to: users+help@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




-- 
For unsubscribe instructions e-mail to: users+help@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.