Rogue Wave banner
Previous fileTop of DocumentContentsIndex pageNext file
Objective Grid User's Guide
Rogue Wave web site:  Home Page  |  Main Documentation Page

13.4 Returning References

Take a look at this code. It sets the style properties for cell (4,2).

At first glance, you might think the syntax is wrong. SetStyleRange() takes two arguments in the above call. The second argument is:

The methods SetValue(), SetControl(), SetVerticalAlignment(), SetHorizontalAlignment(), and SetEnabled() are all members of CGXStyle. Each of these methods has a return value of the this pointer. That is, each method returns a reference to its object. So the call to CGXStyle().SetValue("Welcome") returns a reference to the style object which allows it to call SetControl(GX_IDS_CTRL_STATIC), which in turn returns a reference to the style object, which allows it to call SetVerticalAlignment(DT_VCENTER), and so on. The code above is a shortcut for writing the code below. It is intelligible and makes it easier for the programmer by allowing him to write a single statement to initialize all the attributes instead of one statement for each attribute.



Previous fileTop of DocumentContentsNo linkNext file

Copyright © Rogue Wave Software, Inc. All Rights Reserved.

The Rogue Wave name and logo, and Stingray, are registered trademarks of Rogue Wave Software. All other trademarks are the property of their respective owners.
Provide feedback to Rogue Wave about its documentation.