wxWidgets/samples/xrc/rc/variable.xrc
2015-06-05 02:54:46 +04:00

60 lines
3.3 KiB
XML

<?xml version="1.0" encoding="ISO-8859-1"?>
<resource xmlns="http://www.wxwidgets.org/wxxrc" version="2.5.3.0">
<object class="wxDialog" name="variable_expansion_dialog">
<title>Variable Expansion Example</title>
<centered>1</centered>
<object class="wxFlexGridSizer">
<cols>1</cols>
<rows>0</rows>
<vgap>0</vgap>
<hgap>0</hgap>
<growablecols>0</growablecols>
<growablerows>0</growablerows>
<object class="sizeritem">
<flag>wxGROW|wxALIGN_CENTER_VERTICAL|wxALL</flag>
<border>5</border>
<object class="wxTextCtrl" name="message_textctrl">
<size>500,150</size>
<style>wxTE_MULTILINE</style>
<value>VARIABLE EXPANSION ISN'T IMPLEMENTED CURRENTLY. You can use variable expansion in your XRC files. The steps to do this are:\n\n(1)Enclose a variable inside a dollarsign and round brackets, like this: dollarsign(version).\n\n(2) Set the XmlResource flags to allow expansion of variables.\n\n(3)Before you use that XML resource, inform the XmlResourceHandler what you want that variable's value to be, via wxResourceHandler::Get()-&gt;SetVariable( "version", "2.4.0")\n\n Now, at runtime, the variable will be automatically replace by its value before the control is constructed.\n\nThe number in the version at the bottom of this dialog is an example of this expansion in action.\n\nThis is very handy for things like replacing the text in a wxStaticText, since it is a much simpler way to make a wxStaticText be a proper size: by creating it at the proper size. This is in contrast to the alternative way of using some static non-variable value in your XRC, having XRC construct it, then your application having code to change the text of it, then your app getting its best size, then setting the statictext's size, then laying out the dialog's sizer again, and other work.</value>
</object>
</object>
<object class="sizeritem">
<flag>wxGROW|wxALIGN_BOTTOM</flag>
<object class="wxFlexGridSizer">
<cols>3</cols>
<rows>0</rows>
<vgap>0</vgap>
<hgap>0</hgap>
<growablecols>2</growablecols>
<growablerows>0</growablerows>
<object class="sizeritem">
<flag>wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM</flag>
<border>5</border>
<object class="wxStaticText" name="build_information_statictext">
<label>This build is:</label>
</object>
</object>
<object class="sizeritem">
<flag>wxALIGN_CENTRE|wxALL</flag>
<border>5</border>
<object class="wxStaticText" name="version_statictext">
<label>$(version)</label>
</object>
</object>
<object class="sizeritem">
<flag>wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL</flag>
<border>5</border>
<object class="wxButton" name="wxID_OK">
<label>OK</label>
</object>
</object>
</object>
</object>
</object>
</object>
</resource>