Home » Developer & Programmer » Forms » Avoid error message if canvas doesn't exist (Forms 10, Windows XP)
icon5.gif  Avoid error message if canvas doesn't exist [message #385579] Tue, 10 February 2009 03:04 Go to next message
l0b0
Messages: 13
Registered: November 2006
Junior Member
I'm trying to implement a debug mode in some forms, so that if it's enabled the canvas named "DEBUG" will be set as visible. I've added the code to a when-new-form-instance trigger which is inherited by all the forms, but the problem now is that if the form doesn't exist,
set_view_property('DEBUG', visible, property_true);
generates an FRM-41053 error message. I've tried catching it, but it doesn't work. I can't find any function to check if a canvas exists, and find_view results can't be compared to null or an uninitialized viewport variable. How can I check that a canvas exists, or avoid an error popup on set_view_property with a non-existing canvas?
Re: Avoid error message if canvas doesn't exist [message #385584 is a reply to message #385579] Tue, 10 February 2009 03:17 Go to previous messageGo to next message
Littlefoot
Messages: 20901
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Quote:
I've tried catching it

How? Did you try ON-ERROR / ON-MESSAGE trigger? If not, search the board as there've been examples of how to properly do it.
Re: Avoid error message if canvas doesn't exist [message #385601 is a reply to message #385584] Tue, 10 February 2009 04:00 Go to previous messageGo to next message
l0b0
Messages: 13
Registered: November 2006
Junior Member
Littlefoot wrote on Tue, 10 February 2009 10:17
Quote:
I've tried catching it

How? Did you try ON-ERROR / ON-MESSAGE trigger? If not, search the board as there've been examples of how to properly do it.


Here's the code which results in an error message:
begin
	set_view_property('DEBUG', visible, property_true);
exception
	when others then
		null;
end;


I just realized that on-error is called independently of this - Here's a working version:
:system.message_level := 20;
set_view_property('DEBUG', visible, property_true);
:system.message_level := 0;


Thank you very much!
Re: Avoid error message if canvas doesn't exist [message #385775 is a reply to message #385601] Wed, 11 February 2009 00:25 Go to previous message
djmartin
Messages: 10180
Registered: March 2005
Location: Canberra ACT Australia
Senior Member
Account Moderator
You don't need to quote the whole of the previous post. We can read it!

David
Previous Topic: auto completion combo box
Next Topic: please help
Goto Forum:
  


Current Time: Fri Dec 09 17:20:32 CST 2016

Total time taken to generate the page: 0.16468 seconds