Ask Your Question
0

Macro command to have visibility of screen off while macro runs, so screen stops following macros actions. [closed]

asked 2018-02-25 11:24:03 +0200

updated 2018-02-26 15:06:00 +0200

Macro works ok, but looks sloppy on screen during macro actions.

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Mark McLean
close date 2018-02-26 16:33:32.391874

2 Answers

Sort by » oldest newest most voted
2

answered 2018-02-26 12:41:46 +0200

Lupp gravatar image

updated 2018-02-26 15:53:11 +0200

Instead of trying to lock the view and to unlock it later, you may switch visibility off first and on again at he end of the action.

Sub Demo
theFrame = ThisComponent.CurrentController.Frame
theFrame.ComponentWindow.Visible = False 
'Or: theFrame.ContainerWindow.Visible = False
MsgBox "You can't see the frame now."
theFrame.ComponentWindow.Visible = True  
'Or: theFrame.ContainerWindow.Visible = True  '(respectively)
MsgBox "But now I'm back."
End Sub

(Editing:)
The original subject was about locking the view. It was slightly edited in hindsight.

edit flag offensive delete link more

Comments

Thanks @Lupp!! It worked great. Looks clean now! I reworded my question to your work "visibility", and took out "lock", if it looks OK to you I'll close it, or will tomorrow. Again thanks.

Mark McLean gravatar imageMark McLean ( 2018-02-26 15:01:37 +0200 )edit
1

Closing answers is offered as one way here. IMO it isn't very helpful. If you want to mark your question solved because you accepted one of the answers, click the checkmark at its left.
(In specific cases changing the question/subject subseqent to the answers may leave a contibutor a bit unhappy as he may seem to not have read the question thoroughly enough.)

Lupp gravatar imageLupp ( 2018-02-26 15:51:24 +0200 )edit

Accepting an answer is shown with images at https://ask.libreoffice.org/en/questi....

Jim K gravatar imageJim K ( 2018-02-27 01:26:31 +0200 )edit

Thanks! I hope it's OK now, still, mystical, a guess as I go. Kind of makes me gun shy, that I may mess up, again. But site has been very helpful, thanks for your time, and watching those like me! :) I'll be back.

Mark McLean gravatar imageMark McLean ( 2018-02-27 03:04:00 +0200 )edit
1

answered 2018-02-25 13:54:03 +0200

paul1149 gravatar image

This becomes very important with intensive macros. Use ThisComponent.lockControllers() and then ThisComponent.unlockControllers() at the end.

edit flag offensive delete link more

Comments

Thanks @paul1149. I put lock just below sub name, and unlock just before end sub. Not sure what I am doing wrong! It run, but did not lock screen. Checked to see if I put it in right sub, did. I don't do much more than ask LO to record a macro, do I need to dim, as object?? LO 5.3.4.2, Windows 10.

Mark McLean gravatar imageMark McLean ( 2018-02-25 19:10:40 +0200 )edit

Hmmm. I just realized your query concerns calc, whereas my answer was for writer. It's not working here either in calc. Sorry about that. There should be something similar for calc, but I don't know what it is. My source was Andew's book at http://www.pitonyak.org/oo.php.

paul1149 gravatar imagepaul1149 ( 2018-02-25 20:26:05 +0200 )edit

Thanks. I will save your above commands for writer.

Mark McLean gravatar imageMark McLean ( 2018-02-25 20:35:29 +0200 )edit

@paul1149 I just now noticed the cross in your picture. I, have a Lion, Lamb & Cross! My question was on a spreadsheet that I use for Bible reading, study. Built with my grand kids in mind. You may find it interesting, I hope useful. Do what you like with it. https://goo.gl/pAS4yd

Mark McLean gravatar imageMark McLean ( 2018-02-26 10:18:57 +0200 )edit

Hi Mark. That's a real nice piece of work. Thanks. :)

paul1149 gravatar imagepaul1149 ( 2018-02-26 15:49:51 +0200 )edit

Thanks, means a lot, seeing I know no one personally who likes or uses spreadsheets and you being so active and helpful here on this site. Let me know if ya find something that would make it better. Pass it on to those who like to read the Bible.

Mark McLean gravatar imageMark McLean ( 2018-02-26 16:42:07 +0200 )edit

The link above to Bible reading plan and sorting verses, did not have buttons working on it! I just learned how to have macros to run from the book! Here it is again, working. http://bit.ly/2GxTZFF

Mark McLean gravatar imageMark McLean ( 2018-03-16 08:55:52 +0200 )edit

Question Tools

1 follower

Stats

Asked: 2018-02-25 11:24:03 +0200

Seen: 138 times

Last updated: Feb 26 '18