[Solved] Hide control
							 [Solved] Hide control
						[Solved] Hide control
		
													
							
						
			
			
			
			How to show/hide Control in Base form? For example, I want to hide the button.
			
			
													
					Last edited by kapbepucm on Wed Mar 04, 2009 3:15 pm, edited 1 time in total.
									
			
						
							OOo 3.0.X on Ms Windows XP + Ubuntu 8.10
			
						Re: Hide control
All controls I used so far have a boolean "Visible" property. You should need no more than setting that to True/False.
			
			
									
						
							OOo 3.0.X on Ms Windows W2k
			
						Re: Hide control
Code: Select all
Button2 = StarDesktop.CurrentComponent.DrawPage.Forms.GetByIndex(0).getByName("Button2")
button2.Visible=not button2.VisibleWhy?BASIC runtime error. Property or method not found.
PS: I use standard buttons in standard base form
OOo 3.0.X on Ms Windows XP + Ubuntu 8.10
			
						Re: Hide control
The quote of your code is too incomplete to tell. Guess: incomplete instantiation.
Well, you've expanded your post while I was typing.
I've used it in dialogs so far - would have to try in forms, before I can answer.
			
			
									
						
							Well, you've expanded your post while I was typing.
I've used it in dialogs so far - would have to try in forms, before I can answer.
OOo 3.0.X on Ms Windows W2k
			
						Re: Hide control
ok, full code:
sub "Button1_OnClick" run on click event of button1
Sub "Main" run on open document event of myform
			
			
									
						
							Code: Select all
option explicit
global Button1 as object
global Button2 as object
global Button3 as object
global Button4 as object
global Button5 as object
Sub Main
  Button1 = StarDesktop.CurrentComponent.DrawPage.Forms.GetByIndex(0).getByName("Button1")
  Button2 = StarDesktop.CurrentComponent.DrawPage.Forms.GetByIndex(0).getByName("Button2")
  Button3 = StarDesktop.CurrentComponent.DrawPage.Forms.GetByIndex(0).getByName("Button3")
  Button4 = StarDesktop.CurrentComponent.DrawPage.Forms.GetByIndex(0).getByName("Button4")
  Button5 = StarDesktop.CurrentComponent.DrawPage.Forms.GetByIndex(0).getByName("Button5")
End Sub
sub Button1_OnClick()
  button2.Visible=not button2.Visible
end subSub "Main" run on open document event of myform
I have a standard installationincomplete instantiation
OOo 3.0.X on Ms Windows XP + Ubuntu 8.10
			
						Re: Hide control
Problem solved.
tnk tohttp://www.oooforum.org/forum/viewtopic ... rol#256810 
			
			
									
						
							tnk tohttp://www.oooforum.org/forum/viewtopic ... rol#256810
Code: Select all
dim button2 as object
Button2 = StarDesktop.CurrentComponent.DrawPage.Forms.GetByIndex(0).getByName("Button2")
thiscomponent.currentcontroller.getcontrol(button2).setVisible(False)
OOo 3.0.X on Ms Windows XP + Ubuntu 8.10
			
						Re: [Solved] Hide control
This code does not work correctly in 3.1.0. Why?
			
			
									
						
							OOo 3.0.X on Ms Windows XP + Ubuntu 8.10
			
						