Finding a Specific Control

Real Studio is pretty easy to learn.  Navigation is pretty easy and switching between the layout and code editors is pretty straightforward for the most part.  There are times, however, where the simplicity of Real Studio fights you.

Take for example, this report that comes with the examples folder.  It has a number of layered controls (meaning the controls have a parent) and in this case, their are quite a few ReportLabel and ReportField controls on a ReportRectangle.  In the layout editor this isn’t a big deal because the layout is simple.  Click on any one of the controls and you can get its properties.

 

 

  However, once you get into the code editor, all you see is a list of controls, sorted by name.  There is absolutely no hierarchy that you can deduce from the list.  It’s a major headache for complex layouts, in my opinion.

In my ideal world I’d love the ability to right-click on the item in the code editor and select ‘reveal’ (or similar) and have the layout editor displayed with the control selected.  It would solve some headaches such as the occasional hiccup where Real Studio puts the child control outside of the visible region of the parent.  When that happens, you can no longer see it.  So  how does one ‘select’ the control to either move it, delete it, or otherwise edit it?

You can easily do the opposite case.  In the layout editor, right click on a control and use the “Edit Code” submenu to quickly get to an event in the code editor.  However, for some reason, I rarely use this command.

The contextual menu (i.e. right-click) in the layout editor provides some nifty commands that you might not be aware of.  The one we’re interested in, in this case, is the Select menu.

 

 

 

 

 

What the Select menu does, is give you a listing of all the controls, in their hierarchical, and alphabetical order.  So in this example from one of my current projects shows a relatively simple hierarchy with a GroupBox control (SSFrame6) hosting two canvas controls (cvsHusband, cvsWife) hosting DateControls, Labels, RadioButtons and Pushbuttons.

In some instances, this might be the only way that I could select one of the controls.  It’s easy enough to screw it up.  Make the canvas big enough to fit all the controls in it and then reposition it and resize it so that none of the other controls are visible.

Once this happens you’ll never ‘see’ the control in the layout editor but the code behind the controls might be firing anyway (for example if you have code in their open events) which might cause some issues.

While I’m here I’ll make a plea for some common sense naming conventions.  If you take a look at the RS example, GasReport.rbp above, you’ll notice that all the controls are using their default names.  At a glance you can’t tell what Field1 vs Field10 does.  This is one of those things that drives me crazy!

I see too many OPC (Other Peoples Code) projects every month to condone this behavior.  If I were to get this project to fix, the first thing I’d do is name the major controls (I might skip labels – but only if they’re not referenced in code) so when I see them in the code editor I can, from a glance, see what their intent is.

I know this is nit-picky, but I see it time and time again.  If you’ve subscribed to my Real Studio Video Training Series, you’ll note that I rarely leave the controls with their default name.  The few times I do I tend to apologize for breaking my own ‘rule’.  My thought behind this rule is that I’m not only coding for now, but for five years from now when I open the project again.  I don’t want to have to switch between the code and layout editors to figure out what a pushbutton does.  If it’s named properly I can tell its function.

Anyway, enough of the soapbox.  I hope you learned something.

Any tricks that you’ve discovered in the IDE?

 

Web Edition Tips

The quest to get Web Edition apps running properly on my web server is frustrating.  Every server is different it seems and finding info is truly a PITA.  I have to thank some timely tips from the fine folks at Real Software.  Hopefully you might find these helpful.

Problem #1:  My apps were never shutting down on the server.  I logged into my Plesk account this morning and discovered about 30 cgi processes running for one app I’ve been working on.  Only 1 other person knows of this app so having that many processes was disturbing and obviously not right.

Solution:  My Apache configuration timeout value wasn’t set properly.  I had to create a vhost.conf file and set the Timeout 300.  This let Apache quit the app after 5 minutes.  Of course, for my Plesk account that meant SSH’ing into the file system and via command line do all that (not my strongpoint).

 

Problem #2: Partially because of problem #1, above, I’ve had to manually kill the processes when I upload new versions of the app on to the web server.  That’s not so bad, but when it’s starting up again you sometimes get a Server Error 500 resulting in an error that goes something like this:

Application launched, but unable to connect using port xxx

Hit refresh and the app starts properly but that’s not cool telling your client that what they have to do.

Solution:  A temporary fix comes from the NUG list where Darryl Snover added one line to the CGI file that Real Studio generates.  On line 286 of the appname.cgi file, add a ‘sleep(1)’.  So this becomes:

system(“/$appname_escaped –port”) == 0 or return “$!”;

}

sleep(1);

return 1;

Hopefully you find these tips useful.