Edit: Split from [Solved] Macro: What key is pressed in key down event |
Detect Control or Alt key from the passed event
Detect Control or Alt key from the passed event
Last edited by MrProgrammer on Sat Jul 04, 2020 8:42 pm, edited 1 time in total.
Reason: New question in solved topic requires new topic
Reason: New question in solved topic requires new topic
OpenOffice last version | Mageia Linux x64 | Ubuntu Linux | Windows 8.1 Enterprise x64 | Java last version
-
- Volunteer
- Posts: 1548
- Joined: Wed Jun 24, 2015 12:56 am
- Location: Colorado, USA
Re: [Solved] Macro: What key is pressed in key down event
arfgh
Which indicates that in addition the the A key, the Shift Key was also pressed.
https://www.openoffice.org/api/docs/com ... ifier.html
Because the Modifiers property is a bit mask, had the results showed
then both the Shift and Ctrl keys were pressed (1 + 2)
in the example FJCC posted, the XRAY results showhow to detect control key, or alt from the passed event ?
Code: Select all
Modifiers integer 1
https://www.openoffice.org/api/docs/com ... ifier.html
Because the Modifiers property is a bit mask, had the results showed
Code: Select all
Modifiers integer 3
If your problem has been solved, please edit this topic's initial post and add "[Solved]" to the beginning of the subject line
Apache OpenOffice 4.1.14 & LibreOffice 7.6.2.1 (x86_64) - Windows 10 Professional- Windows 11
Apache OpenOffice 4.1.14 & LibreOffice 7.6.2.1 (x86_64) - Windows 10 Professional- Windows 11
Re: [Solved] Macro: What key is pressed in key down event
ok, other doubt... how to detect same from a control that has no input text capabilities from user ? example a label control.
OpenOffice last version | Mageia Linux x64 | Ubuntu Linux | Windows 8.1 Enterprise x64 | Java last version
-
- Volunteer
- Posts: 1548
- Joined: Wed Jun 24, 2015 12:56 am
- Location: Colorado, USA
Re: [Solved] Macro: What key is pressed in key down event
arfgh
makes no sense. A control that has no user input capabilities will never trigger a Key pressed event.how to detect same from a control that has no input text capabilities from user ? example a label control.
If your problem has been solved, please edit this topic's initial post and add "[Solved]" to the beginning of the subject line
Apache OpenOffice 4.1.14 & LibreOffice 7.6.2.1 (x86_64) - Windows 10 Professional- Windows 11
Apache OpenOffice 4.1.14 & LibreOffice 7.6.2.1 (x86_64) - Windows 10 Professional- Windows 11
Re: [Solved] Macro: What key is pressed in key down event
friend, make sense when you want to have an alternate macro programming for a label control acting as ....hyperlink. When click without control button this, when click with control button, that. So should exist a way to do it.....UnklDonald418 wrote:arfghmakes no sense. A control that has no user input capabilities will never trigger a Key pressed event.how to detect same from a control that has no input text capabilities from user ? example a label control.
OpenOffice last version | Mageia Linux x64 | Ubuntu Linux | Windows 8.1 Enterprise x64 | Java last version
-
- Volunteer
- Posts: 1548
- Joined: Wed Jun 24, 2015 12:56 am
- Location: Colorado, USA
Re: [Solved] Macro: What key is pressed in key down event
A control that has no user input capabilities will never see a Key Pressed event.
A label control will respond to Mouse events. Those events do have the same Modifier properties as Key pressed events.
A label control will respond to Mouse events. Those events do have the same Modifier properties as Key pressed events.
If your problem has been solved, please edit this topic's initial post and add "[Solved]" to the beginning of the subject line
Apache OpenOffice 4.1.14 & LibreOffice 7.6.2.1 (x86_64) - Windows 10 Professional- Windows 11
Apache OpenOffice 4.1.14 & LibreOffice 7.6.2.1 (x86_64) - Windows 10 Professional- Windows 11
Re: [Solved] Macro: What key is pressed in key down event
I know, I know UnklDonald418, for that reason is asked... but see what i want to do... what way or what solutions we can take ? The easy way was just what i thought... if control is pressed this, and that if not. But the events are on labels... Surely exist some way to do it, or something that acts near....
OpenOffice last version | Mageia Linux x64 | Ubuntu Linux | Windows 8.1 Enterprise x64 | Java last version
-
- Volunteer
- Posts: 1548
- Joined: Wed Jun 24, 2015 12:56 am
- Location: Colorado, USA
Re: [Solved] Macro: What key is pressed in key down event
A label control also has When receiving focus and When losing focus events, but it will never respond to those either.
Object oriented programming is based on inheritance and code reuse so perhaps they share some code with the Mouse events.
Maybe Mouse inside uses code from When receiving focus and Mouse outside uses code from When losing focus.
Likewise Mouse button pressed and Mouse button released are similar to Key pressed and Key released events.
Only a developer would know for sure.
Object oriented programming is based on inheritance and code reuse so perhaps they share some code with the Mouse events.
Maybe Mouse inside uses code from When receiving focus and Mouse outside uses code from When losing focus.
Likewise Mouse button pressed and Mouse button released are similar to Key pressed and Key released events.
Only a developer would know for sure.
If your problem has been solved, please edit this topic's initial post and add "[Solved]" to the beginning of the subject line
Apache OpenOffice 4.1.14 & LibreOffice 7.6.2.1 (x86_64) - Windows 10 Professional- Windows 11
Apache OpenOffice 4.1.14 & LibreOffice 7.6.2.1 (x86_64) - Windows 10 Professional- Windows 11
Re: [Solved] Macro: What key is pressed in key down event
and is there a way to listen for global* keypress event other than the event is listening ?
OpenOffice last version | Mageia Linux x64 | Ubuntu Linux | Windows 8.1 Enterprise x64 | Java last version
Re: [Solved] Macro: What key is pressed in key down event
I presume we're talking about dialogs.
You get label control keypress events the same way: create a macro eg
sub label_keypressed(oevt)
msgbox oevt.keycode 'oevt.keychar 'oevt.modifiers
end sub
And assign the key pressed event to that macro.
If you want the label to receive the keypresses then use
dlg.getcontrol("Label1").setfocus
If you want one sub for all your keypress events then make sure just one control always keeps the focus... set tab index to 0 and tab stop to all the other controls to false... and use setfocus to that control if any of the other controls gain the focus.
You get label control keypress events the same way: create a macro eg
sub label_keypressed(oevt)
msgbox oevt.keycode 'oevt.keychar 'oevt.modifiers
end sub
And assign the key pressed event to that macro.
If you want the label to receive the keypresses then use
dlg.getcontrol("Label1").setfocus
If you want one sub for all your keypress events then make sure just one control always keeps the focus... set tab index to 0 and tab stop to all the other controls to false... and use setfocus to that control if any of the other controls gain the focus.
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
Re: [Solved] Macro: What key is pressed in key down event
Simply assign the event you are interested in to macro My_Macros>MriLib>Module1>MRI
It shows you everything about the event including the source object.
It shows you everything about the event including the source object.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
-
- Volunteer
- Posts: 1548
- Joined: Wed Jun 24, 2015 12:56 am
- Location: Colorado, USA
Re: [Solved] Macro: What key is pressed in key down event
Or assign a hot-key at Tools>Customize>Keyboard
If your problem has been solved, please edit this topic's initial post and add "[Solved]" to the beginning of the subject line
Apache OpenOffice 4.1.14 & LibreOffice 7.6.2.1 (x86_64) - Windows 10 Professional- Windows 11
Apache OpenOffice 4.1.14 & LibreOffice 7.6.2.1 (x86_64) - Windows 10 Professional- Windows 11
Re: [Solved] Macro: What key is pressed in key down event
that hot-key is a possible way but... i dont want to split in two subroutines... just only that detects control key pressed or not.. It's more proper, isnt it ?
OpenOffice last version | Mageia Linux x64 | Ubuntu Linux | Windows 8.1 Enterprise x64 | Java last version
-
- Volunteer
- Posts: 1548
- Joined: Wed Jun 24, 2015 12:56 am
- Location: Colorado, USA
Re: [Solved] Macro: What key is pressed in key down event
In Base if the macro is assigned to the hot key Ctrl+F9, only that key combination will trigger the macro.
If your problem has been solved, please edit this topic's initial post and add "[Solved]" to the beginning of the subject line
Apache OpenOffice 4.1.14 & LibreOffice 7.6.2.1 (x86_64) - Windows 10 Professional- Windows 11
Apache OpenOffice 4.1.14 & LibreOffice 7.6.2.1 (x86_64) - Windows 10 Professional- Windows 11
Re: [Solved] Macro: What key is pressed in key down event
I'm really not following what you want to do, but as you're on windows you can use the windows api to test whether the control key is down. Put this code in a module, run it, and press the control key. It will run forever if you don't press the control key.
Code: Select all
Declare Function GetAsyncKeyState Lib "user32" (ByVal vkey As Long) As Integer
sub checkforControlkeyDown
do
If GetAsyncKeyState( &h11) Then
msgbox "ctrl pressed"
exit do
end if
loop
End Sub
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
Re: [Solved] Macro: What key is pressed in key down event
that was what i was thinking these days... if we can use win32 api in our macros....
OpenOffice last version | Mageia Linux x64 | Ubuntu Linux | Windows 8.1 Enterprise x64 | Java last version
Re: [Solved] Macro: What key is pressed in key down event
JeJe wrote:I'm really not following what you want to do, but as you're on windows you can use the windows api to test whether the control key is down. Put this code in a module, run it, and press the control key. It will run forever if you don't press the control key.
Code: Select all
Declare Function GetAsyncKeyState Lib "user32" (ByVal vkey As Long) As Integer sub checkforControlkeyDown do If GetAsyncKeyState( &h11) Then msgbox "ctrl pressed" exit do end if loop End Sub
Anyways that tip was amazing and works like a charm. But i cant understand the reason to limit key events depending on the controls. Because for example imagine the follow: we have an image control and we want to maximize it when move the mouse over it, but only when we have control key pressed. That example make sense a lot... but i figure that image control doesnt throw key event like label one....
OpenOffice last version | Mageia Linux x64 | Ubuntu Linux | Windows 8.1 Enterprise x64 | Java last version
Re: [Solved] Macro: What key is pressed in key down event
Once again: This is NOT a development suite for database solutions. It is an office suite with a download size of less than 200 MB, including all the components and 2 macro languages, help files and a database engine. The form controls were made in the 90ies (StarOffice 5?) and did not change since then.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Re: [Solved] Macro: What key is pressed in key down event
I dont care Villeroy, At the moment i have seen how it is possible to achieve all kind of solutions, and with each update, AOO works better and better.
OpenOffice last version | Mageia Linux x64 | Ubuntu Linux | Windows 8.1 Enterprise x64 | Java last version
Re: [Solved] Macro: What key is pressed in key down event
Which updates are you talking about? OpenOffice has not been updated significantly since many years.
P.S: latest Base features added in 2012: https://wiki.openoffice.org/wiki/Base/N ... res_in_3_4
P.S: latest Base features added in 2012: https://wiki.openoffice.org/wiki/Base/N ... res_in_3_4
Last edited by Villeroy on Tue Apr 09, 2019 10:22 pm, edited 1 time in total.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
-
- Volunteer
- Posts: 1548
- Joined: Wed Jun 24, 2015 12:56 am
- Location: Colorado, USA
Re: [Solved] Macro: What key is pressed in key down event
Add this near the beginning of you image resize macro to check for the Ctrl keywe have an image control and we want to maximize it when move the mouse over it, but only when we have control key pressed
Code: Select all
REM use AND to also capture Ctrl key modifier combinations
if (oEv.Modifiers AND com.sun.star.awt.KeyModifier.MOD1) = 0 then
exit sub
end if
Now move the mouse cursor over the image and press the Ctrl key to resize the image.
If you also want to be able to hold down the Ctrl key and then move the mouse cursor over the image control, add a link to the Mouse inside event .
If your problem has been solved, please edit this topic's initial post and add "[Solved]" to the beginning of the subject line
Apache OpenOffice 4.1.14 & LibreOffice 7.6.2.1 (x86_64) - Windows 10 Professional- Windows 11
Apache OpenOffice 4.1.14 & LibreOffice 7.6.2.1 (x86_64) - Windows 10 Professional- Windows 11
Re: [Solved] Macro: What key is pressed in key down event
Since 6 years we write all the macros for this idiot. He does not understand any hints until you explicitly tell him what to do exactly.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Re: [Solved] Macro: What key is pressed in key down event
idiot ? the most probable is that i kick ass you totally on other kind of programming languages. The reason that you seem an expert with AOO api dont make you a wise man... in fact who is the idiot ? the idiot or the idiot that call others idiot ?Villeroy wrote:Since 6 years we write all the macros for this idiot. He does not understand any hints until you explicitly tell him what to do exactly.
have a nice day Mr. wiseman.
OpenOffice last version | Mageia Linux x64 | Ubuntu Linux | Windows 8.1 Enterprise x64 | Java last version