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?


5 thoughts on “Finding a Specific Control

  1. i often do this another way around – from code to control.
    let’s say: you open a project. it contains a window with a pagepanel (maybe 15 pages), and a lot of controls there. somewhere in the code you read: lstNotifications.ScrollPosition = aWrongValue
    where (and what) is lstNotifications? Just right-click on it in the Code-Editor, and “Go To lstNotifications”… it even brings you to the correct page on the PagePanel in the Layout Editor.

    • I just discovered about this today. Unfortunately, it doesn’t work if you’re referencing the controls as ‘me’ in one of the controls events.

  2. I use the Bookmarks bar a lot, but when you drag a method up to it always says Main_Window.Some_Method, which takes up a lot of spce. Right-click on the Bookmarks bar, choose customize and you can double-click on any method name in the Bookmarks dialog. I name them something much shorter, so that I can get more of my heavily used methods onto the Bookmark bar.

  3. It’s not a total solution but labels are often generic and it’s not necessary to have them labeled. So I make them an array. It cuts down on some of the clutter but not all of it. I can’t complain because I’ve never been able to think of anything better. The new UI demoed in Atlanta looks like a big improvement. HUGE. I wasn’t one of the complainers when it switched last time because I like the unified setup. But the tabs become overwhelming.

    • I often fight with control arrays, but yes, Labels are one that I don’t mind as long as they’re not referenced in code.

      I didn’t complain about the UI change back in 2005 either, but what sucked was that it introduced many, many bugs that took years to work out. I’m really hoping that this new UI won’t cause the same issue.

      One thing I really hope the new UI fixes is the total reliance on the mouse. I feel like I’m using the mouse constantly and I really wish there were some keyboard shortcuts for some common actions.

Comments are closed.