[Solved] MouseEvent And CellBackColor

Creating a macro - Writing a Script - Using the API

[Solved] MouseEvent And CellBackColor

Postby Kiel » Sun Dec 28, 2014 10:03 pm

Hello,

In the attached example when clicked with the mouse in the cell "B4" - "RED CellBackColor" meets the B2 to P2 cells with red background color.

But moving the mouse selects cells.

How to solve this? That is, how to return control to the cells? I'm already more than a week in this routine and after several tests still can not solve it.

Any help is welcome.

Note .: - If you press the "ESC" it stops select with the mouse.
           - Setting the print command "x" also stop select with the mouse.

Thanks,

Kiel
Attachments
MouseEvent And CellBackColor.ods
(11.79 KiB) Downloaded 32 times
Sheet1.png
Last edited by Kiel on Mon Dec 29, 2014 3:42 am, edited 2 times in total.
OpenOffice 3.4 - LibreOffice 4.0 / 4.1 / 4.2 on Windows Seven
User avatar
Kiel
 
Posts: 44
Joined: Wed Nov 26, 2014 5:28 pm

Re: MouseEvent And CellBackColor

Postby Zizi64 » Mon Dec 29, 2014 12:05 am

1.: Do not move the mouse, while the macro is running

2.: Use Form Control elements (Buttons) or Hyperlinks associated to separated subroutines to launch the macros.

Code: Select all   Expand viewCollapse view
Sub ResetBackroundColor

   oDoc  = ThisComponent.CurrentSelection
   oSheet = ThisComponent.Sheets(oDoc.RangeAddress.Sheet)

    oCell=oSheet.getCellRangeByName("B2:P2")
    oCell.clearContents(23)
    oCell.CellBackColor=RGB(255,255,255)
End Sub


Sub SetBackroundColor

   oDoc  = ThisComponent.CurrentSelection
   oSheet = ThisComponent.Sheets(oDoc.RangeAddress.Sheet)

           For i=1 to 15
              oCell=oSheet.getCellByPosition(i,1)
              oCell.CellBackColor=RGB(255,51,51)
              Wait 100
           Next
End Sub


MouseEvent And CellBackColor.ods
(19.96 KiB) Downloaded 28 times
Last edited by Zizi64 on Mon Dec 29, 2014 10:46 am, edited 1 time in total.
Tibor Kovacs, Hungary; LO6.1.6 on Win7-10 x64Prof.
PortableApps, winPenPack: LO3.3.0-6.2.5; AOO4.1.5
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
User avatar
Zizi64
Volunteer
 
Posts: 8092
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: MouseEvent And CellBackColor

Postby Kiel » Mon Dec 29, 2014 3:40 am

Thank Zizi64,

I studied his suggestion and will be used.

Another suggestion, which is also thank the Piaf, which follows in the attached file.

Hugs,

Kiel
Attachments
[Solved] MouseEvent And CellBackColor.ods
(18.75 KiB) Downloaded 49 times
OpenOffice 3.4 - LibreOffice 4.0 / 4.1 / 4.2 on Windows Seven
User avatar
Kiel
 
Posts: 44
Joined: Wed Nov 26, 2014 5:28 pm


Return to Macros and UNO API

Who is online

Users browsing this forum: No registered users and 12 guests