[SOLVED] Highlight entire row with the active cell

Discuss the spreadsheet application
Post Reply
Bambamn
Posts: 43
Joined: Fri Nov 02, 2012 8:38 pm

[SOLVED] Highlight entire row with the active cell

Post by Bambamn »

I have read a few post on this issue, even downloaded the examples. However, I couldn't get it to work for my needs.

My range is from b6 : t301

I would like the entire row within that range by highlighted either with a black border or all cells in Sky Blue, when a cell is clicked within that row.
I just don't get how to do this.

Any help or guidance would be appreciated.
Last edited by MrProgrammer on Sun Mar 28, 2021 4:50 am, edited 4 times in total.
Reason: Add green tick
OpenOffice Win 10
User avatar
RusselB
Moderator
Posts: 6646
Joined: Fri Jan 03, 2014 7:31 am
Location: Sarnia, ON

Re: Highligting Row

Post by RusselB »

If you want the entire row, then your range has to include the entire row.
Your range only goes from column B to column T. A full row goes from A to AMJ
Aside from that, I can't help as I don't understand what it is you are trying to do. By default only the single cell that the cursor is in is highlighted when the cursor is moved.
OpenOffice 4.1.7, LibreOffice 7.0.1.2 on Windows 7 Pro, Ultimate & Windows 10 Home (2004)
If you believe your problem has been resolved, please go to your first post in this topic, click the Edit button and add [Solved] to the beginning of the Subject line.
eeigor
Posts: 214
Joined: Sun Apr 12, 2020 10:56 pm

Re: Highligting Row

Post by eeigor »

Try it...
Run RegisterMouseClickHandler. UnregisterMouseClickHandler to stop working.
Additional column highlighting commented out by 'Rem'.

Code: Select all

Global oDocView, oMouseClickHandler

Sub RegisterMouseClickHandler
	oDocView = ThisComponent.currentController
	oMouseClickHandler = createUnoListener("MyApp_","com.sun.star.awt.XMouseClickHandler")
	oDocView.addMouseClickHandler(oMouseClickHandler)
End Sub

Sub UnregisterMouseClickHandler
	oDocView.removeMouseClickHandler(oMouseClickHandler)
End Sub

Sub MyApp_disposing
End Sub

Function MyApp_mousePressed(oEvt) As Boolean
	MyApp_mousePressed=False
End Function

Function MyApp_mouseReleased(oEvt) As Boolean
	MyApp_mouseReleased=False
	On Error Resume Next
	oCell = ThisComponent.CurrentSelection
	oRanges = ThisComponent.createInstance("com.sun.star.sheet.SheetCellRanges")
Rem	oCol = oCell.Columns.getByIndex(0).RangeAddress
	oRow = oCell.Rows.getByIndex(0).RangeAddress
	oRanges.addRangeAddresses(Array(oCell.RangeAddress, oCol, oRow), False)
	ThisComponent.CurrentController.select(oRanges)
End Function 
Ubuntu 18.04 LTS • LibreOffice 7.5.3.2 Community
Bambamn
Posts: 43
Joined: Fri Nov 02, 2012 8:38 pm

Re: Highligting Row

Post by Bambamn »

Getting error
Screenshot_3.png
OpenOffice Win 10
Bambamn
Posts: 43
Joined: Fri Nov 02, 2012 8:38 pm

Re: Highligting Row

Post by Bambamn »

Here is a better shot of the location, maybe.
Screenshot_5.png
OpenOffice Win 10
Bambamn
Posts: 43
Joined: Fri Nov 02, 2012 8:38 pm

Re: Highligting Row

Post by Bambamn »

i COPY AND PASTED AGAIN, NOW GET THIS ERROR.
Screenshot_6.png
OpenOffice Win 10
Bambamn
Posts: 43
Joined: Fri Nov 02, 2012 8:38 pm

Re: Highligting Row

Post by Bambamn »

And now it works perfectly

Thanks eeigor!!
OpenOffice Win 10
eeigor
Posts: 214
Joined: Sun Apr 12, 2020 10:56 pm

Re: Highligting Row

Post by eeigor »

You have extra lines in the screenshot there.
Ubuntu 18.04 LTS • LibreOffice 7.5.3.2 Community
Post Reply