Hi,
anyone having an example of toggling a buttons enabled and or visible property
Thanks
			
			
													[Solved] Disable button on mainform
							
						[Solved] Disable button on mainform
		
													
							
						
			
			
			
			
					Last edited by gkick on Thu Oct 17, 2019 4:46 am, edited 1 time in total.
									
			
						
							Libre Office 6.4.6 on Windows 10 HSQL 2.51 backend
			
						- 
				UnklDonald418
 - Volunteer
 - Posts: 1573
 - Joined: Wed Jun 24, 2015 12:56 am
 - Location: Colorado, USA
 
Re: Disable button on mainform
Your macro must first find the oForm object, and that depends on the structure of the form and how the macro is triggered.  Once you have the oForm object then to toggle the Enabled property use
or if you want to toggle visibility use
			
			
									
						
							Code: Select all
oButton = oForm.getByName("NameOfTargetButton")
If oButton.Enabled = TRUE then
   oButton.Enabled = FALSE
Else
   oButton.Enabled = TRUE
End ifCode: Select all
oButton = oForm.getByName("NameOfTargetButton")
If oButton.EnableVisible = TRUE then
   oButton.EnableVisible = FALSE
Else
   oButton.EnableVisible = TRUE
End ifIf your problem has been solved, please edit this topic's initial post and add "[Solved]" to the beginning of the subject line 
Apache OpenOffice 4.1.14 & LibreOffice 7.6.2.1 (x86_64) - Windows 10 Professional- Windows 11
			
						Apache OpenOffice 4.1.14 & LibreOffice 7.6.2.1 (x86_64) - Windows 10 Professional- Windows 11
							
						[Solved]Re: Disable button on mainform
		
													
							
						
			
			
			
			Thank you UnclDonald ! Had the first piece of code working and the button came back at restarting base. Appreciate your time and help
regards
Gerhard
			
			
									
						
							regards
Gerhard
Libre Office 6.4.6 on Windows 10 HSQL 2.51 backend