Text document key event

Discussions about using 3rd party extension with OpenOffice.org

Text document key event

Postby maram.j.a » Sat Oct 31, 2020 10:22 am

Hello

I am trynig to build an extension for the first time
I am using java and eclips idE
But I am having problem with the key events
I implented the XKeyListener to my main class
And override the methods
But it show me no respons is there somthing other than java implementation I should do to make it work
Pleas help me out
OOo 4.1
win64
maram.j.a
 
Posts: 6
Joined: Thu Oct 29, 2020 8:19 am

Re: Text document key event

Postby JeJe » Sat Oct 31, 2020 12:44 pm

You need to use a keyhandler not a keylistener to override events
Openoffice 4.1.6
Windows 8
JeJe
Volunteer
 
Posts: 1541
Joined: Wed Mar 09, 2016 2:40 pm

Re: Text document key event

Postby maram.j.a » Sat Oct 31, 2020 1:28 pm

thank you so much for answering me
i trayed to switch to the XKeyHandler but still not having any respons

@Override
public void disposing(EventObject arg0) {
// TODO Auto-generated method stub

}

@Override
public boolean keyPressed(KeyEvent arg0) {
// TODO Auto-generated method stub
myFrame.Show();
return false;
}

@Override
public boolean keyReleased(KeyEvent arg0) {
// TODO Auto-generated method stub
return false;
}
OOo 4.1
win64
maram.j.a
 
Posts: 6
Joined: Thu Oct 29, 2020 8:19 am

Re: Text document key event

Postby RoryOF » Sat Oct 31, 2020 1:43 pm

There is a keyhandler example at
https://jezzper.com/jezzper/discussions.nsf/0/D7A1569F38B30B8CC1256F65002B1DA8

You will probably have to translate the code to fit your usage.
Apache OpenOffice 4.1.10 on Xubuntu 20.04.2 (mostly 64 bit version) and very infrequently on Win2K/XP
User avatar
RoryOF
Moderator
 
Posts: 32560
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: Text document key event

Postby Villeroy » Sat Oct 31, 2020 1:43 pm

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
User avatar
Villeroy
Volunteer
 
Posts: 29729
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Text document key event

Postby JeJe » Sat Oct 31, 2020 1:47 pm

I don't know Java but here's some code in Basic. You have to return true if you want to stop the event.

Code: Select all   Expand viewCollapse view

global oXKeyHandler as object

sub StartXKeyHandlerN

   dim oDoc
   oDoc =thiscomponent
   oXKeyHandler = CreateUnoListener("KeyHandler_", "com.sun.star.awt.XKeyHandler")
   oDoc.CurrentController.AddKeyHandler(oXKeyHandler)
end sub

sub KeyHandler_Disposing(ev)
end sub

function KeyHandler_KeyPressed(ev) as boolean
if ev.keychar = "I" or ev.keychar = "i" then
KeyHandler_KeyPressed = true
else
KeyHandler_KeyPressed = false
end if

End function

function KeyHandler_KeyReleased(ev) as boolean
end function

Openoffice 4.1.6
Windows 8
JeJe
Volunteer
 
Posts: 1541
Joined: Wed Mar 09, 2016 2:40 pm

Re: Text document key event

Postby maram.j.a » Sat Oct 31, 2020 3:38 pm

the Basic code worked just fine in macro
so i wonder is there any way to call a java method into macro
if not then how can i generate macro that can connect to mysql database
 Edit: Topic locked to prevent fragmentation of discussion because maram.j.a has asked the same question in Calling java method in to OOobasic macro 
OOo 4.1
win64
maram.j.a
 
Posts: 6
Joined: Thu Oct 29, 2020 8:19 am

Re: Text document key event

Postby Mountaineer » Sat Oct 31, 2020 4:22 pm

For the mySQL-Topic you should open a seperate Thread.

I know only the german Version of the Handbook for base,vbut it describes several macros and connections to mySQL.

J.
OpenOffice 3.1 on Windows Vista
Mountaineer
 
Posts: 67
Joined: Sun Sep 06, 2020 8:27 am


Return to Extensions

Who is online

Users browsing this forum: No registered users and 2 guests