How to change the appearance of a button once it has been clicked in libre impress - libreoffice-basic

I have what should be a fairly straightforward question regarding libre impress. I want to make several buttons to jump around the document and I would also like these buttons to indicate that they have been clicked before.
To achieve this I used simple shapes (stars in my case) and added an interaction feature to jump to the desired location. So far so simple. In order to indicate that a button has been clicked before, I thought the easiest way would be to change transparency, colour or size of the shapes. Really any of those would be fine for me. I thought this could be done with a macro. My problems are the following:
I don't know how to write the macro. I have a rudimentary understanding of scripting (mostly Python) but not with this particular language.
I don't seem to be able to attach two interactions to one object (i.e. one for the jumping and one one for the macro to change the appearance).
I hope that there is a simple solution to this. Thanks in advance!

The tag is for Basic, so I'll go with that. However, LibreOffice macros can also be written in Python. To get started with Python macros, use APSO and check out this tutorial.
Anyway, here is some Basic code for Impress to point you in the right direction.
oDoc = ThisComponent
oDrawPage = oDoc.getDrawPages().getByIndex(0)
oShape = oDrawPage.getByIndex(0)
mri(oShape)
MsgBox(oShape.getControl().Label)
Whether you decide on Basic or Python, get the MRI extension in order to discover UNO properties of an object. This way you can find out how to change the button.
When you have some code, post another question or edit this one that shows the code you have so far, and describe problems you encountered.

Related

MS Office Word macro, play sound upon scrolling through certain pages

I've already got the useful tip of how to play an external audio file.
And now I'm struggling of how to use it upon reaching a certain page.
I've managed to find that I have to add the stuff below to obtain a list of events I can use:
Public WithEvents App As Word.Application
And I got a plenty of the events:
App events
But no one from them seems corresponding to what I need.
1)Find out a certain event I can use, to track any action which might change currently viewed page(mouse scroll, arrows, page up/down, mouse move with selection, or any of others..) and then paste a checking function into.
2)The checking function supposed to obtain number of current page within the document(or it's equivalent) and if we are at a certain page play corresponding sound.
There are 2 main problems I've struggled with, but got no good idea.
I also aware that we can use ActiveX object and insert an audio file into the document, it allows to even not keep the file somewhere, but embeed it into the doc.
However here I even have no idea of how to trigger playing of the file through VBA.
But if somebody can advise about it would be perfect because it even more handy, in terms of maintenance(no need to keep external audio files).
Any help is appreciated.
If you know that it's impossible in general, please also let me know, so I can close the topic.

Excel ActiveX controls changing size with resolution still not fixed?

OK, this might be a bit of a generic and repeated non-code question but the latest article I can find about this is from over 2 years ago, so I'm wondering if there's been a fix or an update or maybe some clever dude out there has cracked the secret to curing this.
Every time I extend my screen while Excel (2007, 2010 or 2013) is running, and every time I unplug from an extension while Excel is running, my ActiveX controls are rendered useless, because with each click they either shrink or get bigger, depending on if I extended or unplugged.
This happens until I close the Excel application and restart it, unfortunately if I've saved it while the buttons are bigger/smaller they might end up stuck like that.
There is a thread here which has a bit code to help deal with the issue but quite frankly I'm hoping by now, two years later, someone has a slightly more efficient method of dealing with it.
I've took to using hyperlinks to run macros now but that's no good for my drop-boxes and things. And for me personally, I can just make sure I close Excel before extending/unplugging, but the real issue is I'm developing apps for people around the company and it's starting to cause problems with these damned buttons.
Does anyone know of a definitive fix for this yet?
If you only need ActiveX buttons to run macros, use Shapes instead. You can assign macros to a s shape's Click event. Right-click the shape and select "Assign Macro".

Disabling Mouse Click From Changing Selected Index in ListBox

Background:
In my program, I have a list of commands that I am sending to a robot. Each command is numbered, and I display them in a list box. When my program finishes running each command, I want it to highlight the next line in the list box. Changing the SelectedIndex seems to give me what I want. However, I do not want the User to be able to change the SelectedIndex through mouse click.
What I have tried so far:
Disabling the list box doesn't work because it disables scrolling
WPF: Disable ListBox, but enable scrolling The solution here seems kind of a bit of a hack, and does not quite give me what I am looking for.
ListView - select index only programmatically Intended for C#, not very familiar with C#, so I'm not exactly sure if this solution will work if I try translating it over to vb.net. If this solution is indeed correct, could I get some guidance on how to translate this to vb.net?
I am kind of stuck at this point, it kind of seems like I should be looking for a better solution to this problem. What do you guys recommend? should I continue trying to look for a way to disable the user from changing selected index with mouse click or should I go a completely different route?

Create a basic application that will act as a tutorial for how to use another app

I have a very particular application I have developed. I want to create a second app, ideally in visual basic, that provides a tutorial/ guide on how to use my original app step by step.
I imagine PowerPoint slide style images embedded in a simple window with forward & back controls.
I have experience in java, C & VB. Ideally the app needs be be kept simple and written in VB. Can anyone recommend a starting point, or if any tutorials for such exist? I've had a search and nothing stands out.
Thanks.
So, if this essentially just has slides and annotations and forward/backward buttons, why try to write an app for this? (I get that it might be fun to try.) You could simply do screen captures and annotate them and use PowerPoint and create an executable out of that to run.
You can even, I understand, create hyperlinks and such to allow the slide show to progress more like the real app does. I'm no "power point ranger" so I'd point you at the Office docs to learn about that, but I've seen some pretty good tutorials using this method.

I'd like to preview a Word document on form

Update2: For now, I'm considering saving a temporary copy of the document in html format to display it, but this kills my idea to show the user's real time affect on the document. It's just bad practice to re-save at every character input and reload the browser. So, I suppose this may just be impractical for now. I'll keep my ear to this thread for any answers that might arise. Thank you for your help.
Update1: The WebBrowser works for PDF, but not Word Documents for some reason. Instead of displaying in the browser control, it opens the document in word. This is apparently something having to do with file to program association within the operating system, but I'm programming this to work on machines besides my own. Therefore, I'll either need a work around, or a way to change the setting programmatically.
Interestingly, when I right click on a doc file, click Open With, and select Internet Explorer, it opens Word.
Original Question:
I'm writing a VB program that fills in
values within a word document. I'm
utilizing the Microsoft Word 12.0
Object Library as a Reference.
I'd like to provide a scrollable preview pane to my user that is within
the form he or she is using. It
would be even cooler if the user could
edit the document through this pane.
I've done Interop extensively, so I'm
well aware of how to write and edit a
Word document. I just want to put it
into a frame and preview it. I'll
probably try to select around the
document based on what is changing as
the user provides input so they can
see what's being changed and where.
Thoughts?
Thanks
Would the print preview not do this?
Edit: Removed previous answer since it's not recommended by MS.
This article talks about using the WebBrowser control to open OFfice documents instead
http://support.microsoft.com/kb/304643/
Okay, I'm answering my own question, but leveling up those that tried to answer. I've decided that the best solution is to actually open the word document, but keep my form's TopMost property set to True. Then, I can doc my form in the upper right, display the document being edited behind it, and select around to each point being manipulated. This effectively accomplishes what I was after.
Thank you to those that provided answers here. They led me to learn quite a bit of stuff.