[Solved] Form Control Visible/Invisible with macro

Creating a macro - Writing a Script - Using the API

[Solved] Form Control Visible/Invisible with macro

Postby ottoshmidt » Tue Feb 02, 2010 1:44 pm

Hi,

Form Controls in ooo 3.2 have option Visible (Yes, No)... Can I access that property with macros?

I have tried: .visbible = 0 (just like .enabled = 0) but that didn't work...

Is there any possible way?
Last edited by ottoshmidt on Fri Feb 05, 2010 9:07 am, edited 1 time in total.
Debian/testing - Openoffice.org 3.2.1 (go-oo version)

[Solved] mark in title significantly facilitates the work of those who try to help. So please, be gentle and don't forget to insert it. ;)

IRC: /join #openoffice.org on irc.freenode.net
User avatar
ottoshmidt
 
Posts: 32
Joined: Tue Dec 29, 2009 9:17 pm
Location: Tbilisi, Georgia

Re: Form Control Visible/Invisible with macro

Postby FJCC » Tue Feb 02, 2010 10:03 pm

This Basic code toggles the Visible property of a button with a 3 second delay between making it invisible and visible.
Code: Select all   Expand viewCollapse view
Doc = ThisComponent
Sheet = Doc.Sheets.getByIndex(0)
Page = Sheet.DrawPage
Form = Page.Forms.getByIndex(0)
Button = Form.getByName("PushButton")
ButtonCtrl = Doc.CurrentController.getControl(Button)
ButtonCtrl.setVisible(False)
Wait 3000
ButtonCtrl.setVisible(True)

'Button is an object of type com.sun.star.comp.forms.OButtonModel
'ButtonCtrl is an object of type com.sun.star.comp.forms.OButtonControl  This can control object size position visibility etc
Windows 10 and Linux Mint, since 2017
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
FJCC
Moderator
 
Posts: 8252
Joined: Sat Nov 08, 2008 8:08 pm
Location: Colorado, USA

Re: Form Control Visible/Invisible with macro

Postby MikeytheMagnificent » Wed Feb 03, 2010 2:35 am

Sorry, I'm new to all this Macro stuff, perhaps RJCC or ANother could explain if any/or most of this sort of code generates itself as it creates the macro or if you must sit before a blank sheet and amaze me how you've ever became so clever?

Admiration
Many opportunities to add short Tutorials or faq's are missed

1. Must have obvious title to be found easily
2. Keep to objectives
3. Use very clear language
4. Difficult to get right
5. Rewards are few
User avatar
MikeytheMagnificent
 
Posts: 137
Joined: Fri Apr 11, 2008 12:06 am
Location: W. Yorks UK

Re: Form Control Visible/Invisible with macro

Postby FJCC » Wed Feb 03, 2010 3:16 am

Macro code usually has to be written from scratch. The macro recorder will handle simple cases, but quickly loses usefulness. A good place to learn about macros is Andrew Pitonyak's English Macro Document.
Windows 10 and Linux Mint, since 2017
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
FJCC
Moderator
 
Posts: 8252
Joined: Sat Nov 08, 2008 8:08 pm
Location: Colorado, USA

Re: Form Control Visible/Invisible with macro

Postby ottoshmidt » Fri Feb 05, 2010 9:06 am

FJCC wrote:This Basic code toggles the Visible property of a button with a 3 second delay between making it invisible and visible.
Code: Select all   Expand viewCollapse view
Doc = ThisComponent
Sheet = Doc.Sheets.getByIndex(0)
Page = Sheet.DrawPage
Form = Page.Forms.getByIndex(0)
Button = Form.getByName("PushButton")
ButtonCtrl = Doc.CurrentController.getControl(Button)
ButtonCtrl.setVisible(False)
Wait 3000
ButtonCtrl.setVisible(True)

'Button is an object of type com.sun.star.comp.forms.OButtonModel
'ButtonCtrl is an object of type com.sun.star.comp.forms.OButtonControl  This can control object size position visibility etc



Hugely Thankful ;)
Debian/testing - Openoffice.org 3.2.1 (go-oo version)

[Solved] mark in title significantly facilitates the work of those who try to help. So please, be gentle and don't forget to insert it. ;)

IRC: /join #openoffice.org on irc.freenode.net
User avatar
ottoshmidt
 
Posts: 32
Joined: Tue Dec 29, 2009 9:17 pm
Location: Tbilisi, Georgia


Return to Macros and UNO API

Who is online

Users browsing this forum: No registered users and 11 guests