Re: [libreoffice-users] Auto-closing user dialogue (macro, Basic)

2018-12-15 Thread Jean-Francois Nifenecker

Hi Johnny,

Le 09/12/2018 à 19:02, Johnny Rosenberg a écrit :

Hi!
For some reason I can't figure this out…

I have made a simple dialogue with two buttons and a numeric field. Those
buttons triggers two different subroutines that does two different things
and then closes the entire dialogue.

I want the dialogue to close automatically after ten seconds if neither of
the buttons have been pushed. The remaining time is to be displayed in the
numeric field mentioned above.

However, I couldn't find a way to trig a function ”when nothing else
happens”. Here's what I want to do:
Dialogue opens.
User does nothing, so a subroutine is called checking the remaining time
and displays it in the numeric field.
User still doesn't do anything and the above repeats until remaining time
is zero, then the dialogue is closed.

Any suggestions?



Not sure if that can be of help. Have a look at that page:
https://documentation.libreoffice.org/en/english-documentation/macro/

get the Dialogs RefCard 
(https://documentation.libreoffice.org/assets/Uploads/Documentation/en/MACROS/RefCards/LibOBasic-6-Dialogs-Flat-A4-EN-v103.pdf). 
The Non-Modal dialog part might give you some ideas.


HTH,
--
Jean-Francois Nifenecker, Bordeaux


--
To unsubscribe e-mail to: users+unsubscr...@global.libreoffice.org
Problems? https://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: https://wiki.documentfoundation.org/Netiquette
List archive: https://listarchives.libreoffice.org/global/users/
Privacy Policy: https://www.documentfoundation.org/privacy


Re: [libreoffice-users] Auto-closing user dialogue (macro, Basic)

2018-12-15 Thread Luuk


On 9-12-2018 19:02, Johnny Rosenberg wrote:

Hi!
For some reason I can't figure this out…

I have made a simple dialogue with two buttons and a numeric field. Those
buttons triggers two different subroutines that does two different things
and then closes the entire dialogue.

I want the dialogue to close automatically after ten seconds if neither of
the buttons have been pushed. The remaining time is to be displayed in the
numeric field mentioned above.

However, I couldn't find a way to trig a function ”when nothing else
happens”. Here's what I want to do:
Dialogue opens.
User does nothing, so a subroutine is called checking the remaining time
and displays it in the numeric field.
User still doesn't do anything and the above repeats until remaining time
is zero, then the dialogue is closed.

Any suggestions?



I do not think its possible to create a user-defined event in a Macro in 
LibreOffice.



The docs say nothing about how it can be done.

https://wiki.openoffice.org/wiki/Documentation/DevGuide/Basic/Adding_Event_Handlers

https://help.libreoffice.org/Basic/Event-Driven_Macros




--
To unsubscribe e-mail to: users+unsubscr...@global.libreoffice.org
Problems? https://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: https://wiki.documentfoundation.org/Netiquette
List archive: https://listarchives.libreoffice.org/global/users/
Privacy Policy: https://www.documentfoundation.org/privacy


Re: [libreoffice-users] Re: Adding keyboard shortcut

2018-12-15 Thread Luuk


On 9-12-2018 15:21, W. Robert J. Funnell, Prof. wrote:

On Sun, 9 Dec 2018, V Stuart Foote wrote:


Rich Shepard wrote

The *delete* you want is assigned in LibreOffice via the "Backspace"
function, aka a *rubout*.

Not quite. The backspace key deletes the character to the left of the
cursor's position while the Del key deletes the character to the right of
the cursor's position. I want to make ctrl-d function like the Del key.

Yes sorry, that is correct. They are different deletions. The "Delete"
performs what is also called a "forward delete".
Have looked at the project source code.  The forward delete action is among
a class of actions directly implemented in the edit shell and assigned to
the keyboard (symkey) for the Delete key.

It is not  available to assign to additional Keyboard shortcut or menu
entry.

Doing so would require creation of an UNO commond to perform the deletion,
that would be available for use in UI customization.

That seems like something that should be corrected. What other actions
are directly implemented like that?

In the meantime, would it work to define a macro that does
forward-character and then backward-delete, and bind it to Ctrl-D?

- Robert

Creating a Macro that does do just that would introduce a (maybe) 
unwanted feature.


Executing this while the cursor is at the last position of a document, 
the forward-character wil do nothing, but the backward-delete will 
remove the last chaacter of your document (if any).



--

For the interested people in the macro i used to test this:

sub testCtrlD
rem --
rem define variables
dim document   as object
dim dispatcher as object
rem --
rem get access to the document
document   = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")

rem --
dim args1(1) as new com.sun.star.beans.PropertyValue
args1(0).Name = "Count"
args1(0).Value = 1
args1(1).Name = "Select"
args1(1).Value = false

dispatcher.executeDispatch(document, ".uno:GoRight", "", 0, args1())

rem --
dispatcher.executeDispatch(document, ".uno:SwBackspace", "", 0, Array())

rem --
rem dispatcher.executeDispatch(document, ".uno:MacroDialog", "", 0, Array())

end sub


--
To unsubscribe e-mail to: users+unsubscr...@global.libreoffice.org
Problems? https://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: https://wiki.documentfoundation.org/Netiquette
List archive: https://listarchives.libreoffice.org/global/users/
Privacy Policy: https://www.documentfoundation.org/privacy