I meant to add more to this answer.
If I need to include more than a few lines of code in a code panel, I will almost always put that code in a named procedure, and use either the
callwithin statement to invoke it from the panel. This has two advantages. First, the named procedure editor is nicer – it has auto-indent, search, find and replace, and last not least you can change the font size.
But even more important to me than any of these is that I can edit this code while the form is in data mode. This makes it much easier to make adjustments “on-the-fly” to get the code working just the way I want it.
The callwithin statement is new in Panorama X. This is one way to make it easy to handle multiple buttons (or other objects) in a single named procedure. So your View menu doesn’t get cluttered with dozens or even hundreds of named procedures, and you can keep things nice and organized.
Within the named procedure you can use the mark feature to keep things organized.
Right now I’m doing some work on the Database Options dialog. This dialog has dozens of objects in multiple tab panels, but all of the code is in a single procedure. This procedure has grown to over 1,200 lines, but I can navigate it easily because I’ve set up marks for different sections. And of course in Panorama X there’s no longer a worry about a procedure getting too long, there is no longer a 32k limit. In fact this particular procedure contains 57k of code.