[Solved+Issue] Hover message when mouse is over text

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
Shelly Belly
Posts: 8
Joined: Tue May 06, 2014 5:52 pm

[Solved+Issue] Hover message when mouse is over text

Post by Shelly Belly »

Does anyone know a macro that will display a message when mouse is over text.... Any help someone...plzzzz.
Last edited by Hagar Delest on Thu May 22, 2014 10:34 pm, edited 1 time in total.
Reason: tagged [Solved].
Open Office 4.0
Operating System---Windows 7 Professional
Shelly Belly
Posts: 8
Joined: Tue May 06, 2014 5:52 pm

Hover Text

Post by Shelly Belly »

Does anyone know how to create a hover text message when the mouse is over an Object? I really need help on this.
Open Office 4.0
Operating System---Windows 7 Professional
User avatar
RoryOF
Moderator
Posts: 34586
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: Macro to hover message when mouse is over text

Post by RoryOF »

Some information at
viewtopic.php?f=20&t=57791
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS
User avatar
Villeroy
Volunteer
Posts: 31269
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Macro to hover message when mouse is over text

Post by Villeroy »

hover_text.odt
(11.47 KiB) Downloaded 1950 times
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
B Marcelly
Volunteer
Posts: 1160
Joined: Mon Oct 08, 2007 1:26 am
Location: France, Paris area

Re: Macro to hover message when mouse is over text

Post by B Marcelly »

Funny, Villeroy !
I used some formatting to help the user find the texts with hints.
And added another solution.
Attachments
hover_text2.odt
Some texts with hints
(16.41 KiB) Downloaded 1446 times
Bernard

OpenOffice.org 1.1.5 / Apache OpenOffice 4.1.1 / LibreOffice 5.0.5
MS-Windows 7 Home SP1
User avatar
Villeroy
Volunteer
Posts: 31269
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Macro to hover message when mouse is over text

Post by Villeroy »

B Marcelly wrote:And added another solution.
I like the non-functional but nevertheless creative hyperlink. I would have expected that it throws some error about invalid URL or inaccessible resource or something. However, it doesn't which is just fine for this purpose.

Using a so called "group box" as a form control, you can still focus the text under the form control but you've got to live with a thin black border which can't be hidden nor formatted to back color.
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
Shelly Belly
Posts: 8
Joined: Tue May 06, 2014 5:52 pm

Re: Macro to hover message when mouse is over text

Post by Shelly Belly »

Can this be applied to open office calc?
Open Office 4.0
Operating System---Windows 7 Professional
User avatar
Villeroy
Volunteer
Posts: 31269
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Macro to hover message when mouse is over text

Post by Villeroy »

Shelly Belly wrote:Can this be applied to open office calc?
Did you try? No, of course not.
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
acknak
Moderator
Posts: 22756
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

Re: Macro to hover message when mouse is over text

Post by acknak »

Very clever you guys--nice!

For the record, I found an open request for this:
Issue 84037: Request for generic tool tip functionality You can register there and add your vote (up to two) or comment.

Adding a macro for this seems like a steep climb: where would you store the help text? I looked at the ODF file format--it doesn't include any "title" property for links, as with html/web pages. Changing the file format to include something non-standard is not likely to happen.

Maybe an option to display comments as tooltips?

You also get pop-up text with footnotes--maybe that could be used.

NOTE: Calc already has pop-up notes: Insert > Comment
AOO4/LO5 • Linux • Fedora 23
Shelly Belly
Posts: 8
Joined: Tue May 06, 2014 5:52 pm

Re: Macro to hover message when mouse is over text

Post by Shelly Belly »

lol lol thanks alot Villeroy....roryof...bmarcelly...u all were great....I'm learning open office as i go. Thanks again guys.
Open Office 4.0
Operating System---Windows 7 Professional
wgw
Posts: 2
Joined: Tue Sep 09, 2014 8:09 am

Re: [Solved+Issue] Hover message when mouse is over text

Post by wgw »

I looked at hover_text.odt and found no macros...The popup works, but I do not see how it was implemented!

Any clarifications?

Thanks!

(Using LibreOffice under Ubuntu.)
LibreOffice 3.5.7.2 on Ubuntu 12.04
B Marcelly
Volunteer
Posts: 1160
Joined: Mon Oct 08, 2007 1:26 am
Location: France, Paris area

Re: [Solved+Issue] Hover message when mouse is over text

Post by B Marcelly »

They use Label fields (form controls).
Each control is sized over the desired zone, the popup is the help text of the control.
Bernard

OpenOffice.org 1.1.5 / Apache OpenOffice 4.1.1 / LibreOffice 5.0.5
MS-Windows 7 Home SP1
wgw
Posts: 2
Joined: Tue Sep 09, 2014 8:09 am

Re: [Solved+Issue] Hover message when mouse is over text

Post by wgw »

Thanks! I would have never found it. (Anxiously awaiting a "reveal codes" feature for OpenOffice....)

There must be a better way to parachute popup definitions onto items (I will use it for quiz-like exercises).

For the moment, finding a way to hijack the hyperlink popup looks like the most promising (i.e., if the message "ctrl-click to open hyperlink" did not appear, then a link with destination "here is my popup information" would work. You could even make generate the text in html and import it into OO.)

It could be that changing that prompt would not be a massive undertaking...

Thanks again!
LibreOffice 3.5.7.2 on Ubuntu 12.04
euan
Posts: 1
Joined: Mon Jan 12, 2015 5:36 am

Re: [Solved+Issue] Hover message when mouse is over text

Post by euan »

Finding this page has been really useful for me. Thanks all. Another question though:

How did you locate the words on the page (to put into the <draw:control> element)? e.g. the layout location in cms? Is that something you can do automatically, or did you have to manually do that?

Thanks!
OpenOffice 4.1.1 on Windows 7
JeJe
Volunteer
Posts: 2763
Joined: Wed Mar 09, 2016 2:40 pm

Re: [Solved+Issue] Hover message when mouse is over text

Post by JeJe »

Another method to help complete this old thread. If you don't use the recording changes feature that can be adapted... run on a blank Writer Document...

Code: Select all

'based on
'https://www.mail-archive.com/allbugs@openoffice.org/msg356757.html


sub makeRedlinePopupMessage
dim aRedlineProperties(2) as new com.sun.star.beans.PropertyValue
xcrsr = thiscomponent.gettext.createtextcursor
thiscomponent.gettext.setstring( "Popup over Message.")

with xcrsr
.gotostart( false )
.goright( 11, false )
.goright( 7, true )
end with

aRedlineProperties(0).Name = "RedlineAuthor"
aRedlineProperties(0).Value = "Message"
aRedlineProperties(1).Name = "RedlineComment"
aRedlineProperties(1).Value = "Stuck with the " & chr(34) & "Formatted" & chr(34) & " and having a Date/time  but its a way..."
aRedlineProperties(2).Name = "RedlineDateTime"
aRedlineProperties(2).Value = time + date

xcrsr.makeRedline("Format", aRedlineProperties )
end sub
Edit:
NOTE: if you copy and paste the text the message will be lost/not pasted.
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
JeJe
Volunteer
Posts: 2763
Joined: Wed Mar 09, 2016 2:40 pm

Re: [Solved+Issue] Hover message when mouse is over text

Post by JeJe »

Here's an improved version. Select the text that you want to comment and run MakeComment.
To edit the comment/popup run showCommentDialog
You might want to set keyboard shortcuts for these.

The changes/commenting make a good popup comment system. You don't need changes showing to see the popups or to change the comments, the text is unchanged, and the dialog lets you navigate through the comments.

Remember the comments don't get pasted if you copy and paste somewhere.

Code: Select all

sub MakeComment()

OVC = thiscomponent.currentcontroller.viewcursor
TC = OVC.gettext.createtextcursorbyrange(OVC)
makeRedlinePopupMessage TC,"Comment",""
OVC.collapsetostart
showCommentDialog

end sub



sub makeRedlinePopupMessage(TextCur,Author,Comment,Optional DateTime)
dim aRedlineProperties(2) as new com.sun.star.beans.PropertyValue

aRedlineProperties(0).Name = "RedlineAuthor"
aRedlineProperties(0).Value = Author
aRedlineProperties(1).Name = "RedlineComment"
aRedlineProperties(1).Value = Comment
aRedlineProperties(2).Name = "RedlineDateTime"

if ismissing(DateTime) =false then
aRedlineProperties(2).Value = DateTime
else
aRedlineProperties(2).Value = time + date
end if

TextCur.makeRedline("Format", aRedlineProperties )
end sub


sub showCommentDialog
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 ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:CommentChangeTracking", "", 0, Array())
end sub

Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
Post Reply