[Solved] Change an Image Control's graphics via macro
[Solved] Change an Image Control's graphics via macro
I have a Push Button (btnPush1) that calls a macro when clicked.
I have an Image Control (imgPic1) with Graphics set to "C:\A.gif".
It is anchored to Cell A1 (if that helps).
Both are on Sheet1.
I want the macro to change the Graphics on the Image Control to "C:\B.gif"
How would I achieve this?
I have an Image Control (imgPic1) with Graphics set to "C:\A.gif".
It is anchored to Cell A1 (if that helps).
Both are on Sheet1.
I want the macro to change the Graphics on the Image Control to "C:\B.gif"
How would I achieve this?
Last edited by monkee09 on Mon Mar 21, 2016 9:39 pm, edited 1 time in total.
Re: Change an Image Control's graphics via macro.
Maybe it is easier to do this by make a trick: use two buttons (placed on same position), and control those visibility.
A tip:
You can get the pushed button in the assigned macro code:
viewtopic.php?f=45&t=35985
A tip:
You can get the pushed button in the assigned macro code:
viewtopic.php?f=45&t=35985
Last edited by Zizi64 on Sat Mar 19, 2016 8:08 pm, edited 1 time in total.
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
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.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
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.
Re: Change an Image Control's graphics via macro.
That will not work for my purposes.
I need a macro that can access and change the Graphics property of an Image Control.
I need a macro that can access and change the Graphics property of an Image Control.
WindowsXP, OOo3.0.0
Re: Change an Image Control's graphics via macro.
Try this code. You need use LINKED pictures instead of the embedded ones.
Code: Select all
Sub ButtonClick(oEvent)
Button = oEvent.Source
'If (Not GlobalScope.BasicLibraries.isLibraryLoaded("XrayTool")) Then GlobalScope.BasicLibraries.LoadLibrary("XrayTool")
'you can examine the control element by the Xray tool:
'xray Button
If Button.Model.ImageURL = "file:///C:/A.gif" then
Button.Model.ImageURL = "file:///C:/B.gif"
else
Button.Model.ImageURL = "file:///C:/A.gif"
end if
End Sub
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
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.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
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.
Re: Change an Image Control's graphics via macro.
This code successfully changes the image on the button clicked.
If I set the macro to be triggered by clicking on the Image Control, it toggles the image there as well.
But I need the event to be triggered from an event outside of the Image Control, as originally stated in the initial post.
The button is just a means to trigger the event from outside of the Image Control.
I need a macro that is called by a BUTTON, but changes the IMAGE CONTROL, as originally stated.
Two seperate objects. One calling a macro to change the other.
If I set the macro to be triggered by clicking on the Image Control, it toggles the image there as well.
But I need the event to be triggered from an event outside of the Image Control, as originally stated in the initial post.
The button is just a means to trigger the event from outside of the Image Control.
I need a macro that is called by a BUTTON, but changes the IMAGE CONTROL, as originally stated.
Two seperate objects. One calling a macro to change the other.
WindowsXP, OOo3.0.0
Re: Change an Image Control's graphics via macro.
Nevermind, I hunted further and found something close and adapted it to my needs.
In case anyone else would like the answer to this problem, the code is below:
In case anyone else would like the answer to this problem, the code is below:
Code: Select all
Sub ButtonClick(oEvent)
dim oButton
dim oForm
dim oImage
const sName="file:///C:/graphics/G1.GIF"
oButton=oEvent.source.model
oForm=oButton.parent
oImage=oForm.getbyname("imgPic")
oImage.imageurl=sName
oImage.reset
End Sub
WindowsXP, OOo3.0.0
-
- Posts: 2
- Joined: Wed Jun 13, 2018 9:34 am
Change Image using Push Button
Dear,
Please Let Me Know About Insert And Change Image Using Push Button
Please HELP
Thanks
Abrar
Please Let Me Know About Insert And Change Image Using Push Button
Please HELP
Thanks
Abrar
Thanks
Abrar
OpenOffice 3.1 on Windows Vista / NeoOffice 2.2.3 with MacOS 10.4 / OpenOffice 2.4 on Ubuntu 9.04
Abrar
OpenOffice 3.1 on Windows Vista / NeoOffice 2.2.3 with MacOS 10.4 / OpenOffice 2.4 on Ubuntu 9.04
-
- Posts: 2
- Joined: Wed Jun 13, 2018 9:34 am
Re: [Solved] Change an Image Control's graphics via macro
Do You Have Any Video Tutorials Please Update
Thanks
Abrar
OpenOffice 3.1 on Windows Vista / NeoOffice 2.2.3 with MacOS 10.4 / OpenOffice 2.4 on Ubuntu 9.04
Abrar
OpenOffice 3.1 on Windows Vista / NeoOffice 2.2.3 with MacOS 10.4 / OpenOffice 2.4 on Ubuntu 9.04
Re: [Solved] Change an Image Control's graphics via macro
Please read Andrew Pitonyak's free macro books.
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
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.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
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.