summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRafael Lima <rafael.palma.lima@gmail.com>2021-12-04 00:29:59 +0200
committerOlivier Hallot <olivier.hallot@libreoffice.org>2021-12-16 14:41:46 +0100
commit26b5b4754fce269994a1f20938ebd0e4fa7c7c9c (patch)
tree0ee10a9ea43225576720ed31b91e3acc841e582f
parent96d7d761494f43c9eb236b1848c859754b85526f (diff)
Document new TableControl methods and properties
Change-Id: I8623a11f5fb710332765b8db3914a36b51285b7a Reviewed-on: https://gerrit.libreoffice.org/c/help/+/126294 Tested-by: Jenkins Reviewed-by: Jean-Pierre Ledure <jp@ledure.be> (cherry picked from commit 73228ff72af0e4f8ca7e29b4dca388741804cb06) Reviewed-on: https://gerrit.libreoffice.org/c/help/+/126936 Reviewed-by: Olivier Hallot <olivier.hallot@libreoffice.org>
-rw-r--r--source/text/sbasic/shared/03/sf_dialogcontrol.xhp232
1 files changed, 165 insertions, 67 deletions
diff --git a/source/text/sbasic/shared/03/sf_dialogcontrol.xhp b/source/text/sbasic/shared/03/sf_dialogcontrol.xhp
index f21fcef6cd..21ed4c301c 100644
--- a/source/text/sbasic/shared/03/sf_dialogcontrol.xhp
+++ b/source/text/sbasic/shared/03/sf_dialogcontrol.xhp
@@ -119,6 +119,9 @@
<paragraph id="par_id91598456007438" localize="false" role="listitem">ScrollBar</paragraph>
</listitem>
<listitem>
+ <paragraph id="par_id171612698897041" localize="false" role="listitem">TableControl</paragraph>
+ </listitem>
+ <listitem>
<paragraph id="par_id271598456011504" localize="false" role="listitem">TextField</paragraph>
</listitem>
<listitem>
@@ -126,7 +129,6 @@
</listitem>
<listitem>
<paragraph id="par_id171612698897514" localize="false" role="listitem">TreeControl</paragraph>
- <embed href="text/sbasic/shared/03/avail_release.xhp#7.2.control"/>
</listitem>
</list>
<h2 id="hd_id651583668365757" xml-lang="en-US">Properties</h2>
@@ -214,7 +216,6 @@
</tablecell>
<tablecell>
<paragraph id="par_id1001612705482919" role="tablecontent" xml-lang="en-US">The currently upmost node selected in the tree control. Refer to <link href="https://api.libreoffice.org/docs/idl/ref/interfacecom_1_1sun_1_1star_1_1awt_1_1tree_1_1XMutableTreeNode.html" name="awt.tree.XMutableTreeNode">XmutableTreeNode</link> in Application Programming Interface (API) documentation for detailed information.</paragraph>
- <embed href="text/sbasic/shared/03/avail_release.xhp#7.2.property"/>
</tablecell>
</tablerow>
<tablerow>
@@ -282,10 +283,10 @@
<paragraph id="par_id411583774433779" role="tablecontent" localize="false">Long</paragraph>
</tablecell>
<tablecell>
- <paragraph id="par_id531598539561342" role="tablecontent" localize="false">ComboBox, ListBox</paragraph>
+ <paragraph id="par_id531598539561342" role="tablecontent" localize="false">ComboBox, ListBox, TableControl</paragraph>
</tablecell>
<tablecell>
- <paragraph role="paragraph" id="par_id151598177605296" xml-lang="en-US">Specifies the number of rows in a list box or a combo box.</paragraph>
+ <paragraph role="paragraph" id="par_id151598177605296" xml-lang="en-US">Specifies the number of rows in a ListBox, a ComboBox or a TableControl.</paragraph>
</tablecell>
</tablerow>
<tablerow>
@@ -299,10 +300,10 @@
<paragraph id="par_id991588334016273" role="tablecontent" localize="false">Long</paragraph>
</tablecell>
<tablecell>
- <paragraph id="par_id451598539598242" role="tablecontent" localize="false">ComboBox, ListBox</paragraph>
+ <paragraph id="par_id451598539598242" role="tablecontent" localize="false">ComboBox, ListBox, TableControl</paragraph>
</tablecell>
<tablecell>
- <paragraph id="par_id251588334016874" role="tablecontent" xml-lang="en-US">Specifies which item is selected in a list box or combo box.</paragraph>
+ <paragraph id="par_id251588334016874" role="tablecontent" xml-lang="en-US">Specifies which item is selected in a ListBox, a ComboBox or a TableControl.</paragraph>
</tablecell>
</tablerow>
<tablerow>
@@ -423,7 +424,6 @@
</tablecell>
<tablecell>
<paragraph id="par_id11612700624514" role="tablecontent" xml-lang="en-US">An object representing the lowest root node (usually there is only one such root node). Refer to <link href="https://api.libreoffice.org/docs/idl/ref/interfacecom_1_1sun_1_1star_1_1awt_1_1tree_1_1XMutableTreeNode.html" name="awt.tree.XMutableTreeNode">XmutableTreeNode</link> in Application Programming Interface (API) documentation for detailed information.</paragraph>
- <embed href="text/sbasic/shared/03/avail_release.xhp#7.2.property"/>
</tablecell>
</tablerow>
<tablerow>
@@ -575,7 +575,6 @@
</tablecell>
<tablecell>
<paragraph id="par_id691612699446892" role="tablecontent" xml-lang="en-US">The UNO object representing the tree control data model. Refer to <link href="https://api.libreoffice.org/docs/idl/ref/interfacecom_1_1sun_1_1star_1_1awt_1_1tree_1_1XMutableTreeDataModel.html" name="awt.tree.XMutableTreeDataModel">XMutableTreeDataModel</link> in Application Programming Interface (API) documentation for detailed information.</paragraph>
- <embed href="text/sbasic/shared/03/avail_release.xhp#7.2.property"/>
</tablecell>
</tablerow>
</table>
@@ -733,6 +732,17 @@
</tablerow>
<tablerow>
<tablecell>
+ <paragraph id="par_id811598543254007" role="tablecontent" localize="false">TableControl</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id751598543254805" role="tablecontent" localize="false">Array</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id441598543254951" role="tablecontent" xml-lang="en-US">One-dimensional array with the data of the currently selected row.</paragraph>
+ </tablecell>
+ </tablerow>
+ <tablerow>
+ <tablecell>
<paragraph id="par_id811598543254140" role="tablecontent" localize="false">TextField</paragraph>
</tablecell>
<tablecell>
@@ -755,7 +765,6 @@
</table>
<h2 id="hd_id421612628828054" xml-lang="en-US">Event properties</h2>
<paragraph role="paragraph" id="par_id41612629140856" xml-lang="en-US">Returns a URI string with the reference to the script triggered by the event. Read its specification in the <link href="https://wiki.openoffice.org/wiki/Documentation/DevGuide/Scripting/Scripting_Framework_URI_Specification" name="URI specification">scripting framework URI specification</link>.</paragraph>
- <embed href="text/sbasic/shared/03/avail_release.xhp#7.2.events"/>
<table id="tab_id951612628879819">
<tablerow>
<tablecell>
@@ -954,23 +963,23 @@
</tablerow>
<tablerow>
<tablecell><paragraph id="par_id751612709117248" role="tablecontent" localize="false">
- <link href="text/sbasic/shared/03/sf_dialogcontrol.xhp#AddSubNode" name="AddSubNode method">AddSubNode</link><br/>
- <link href="text/sbasic/shared/03/sf_dialogcontrol.xhp#AddSubTree" name="AddSubTree method">AddSubTree</link>
+ <link href="text/sbasic/shared/03/sf_dialogcontrol.xhp#AddSubNode" name="AddSubNode method">AddSubNode</link><br/>
+ <link href="text/sbasic/shared/03/sf_dialogcontrol.xhp#AddSubTree" name="AddSubTree method">AddSubTree</link><br/>
+ <link href="text/sbasic/shared/03/sf_dialogcontrol.xhp#CreateRoot" name="CreateRoot method">CreateRoot</link><br/>
</paragraph></tablecell>
<tablecell><paragraph id="par_id63161270911712" role="tablecontent" localize="false">
- <link href="text/sbasic/shared/03/sf_dialogcontrol.xhp#CreateRoot" name="CreateRoot method">CreateRoot</link><br/>
- <link href="text/sbasic/shared/03/sf_dialogcontrol.xhp#FindNode" name="FindNode method">FindNode</link>
+ <link href="text/sbasic/shared/03/sf_dialogcontrol.xhp#FindNode" name="FindNode method">FindNode</link><br/>
+ <link href="text/sbasic/shared/03/sf_dialogcontrol.xhp#SetFocus" name="SetFocus method">SetFocus</link><br/><br/>
</paragraph></tablecell>
<tablecell><paragraph id="par_id651612709117457" role="tablecontent" localize="false">
- <link href="text/sbasic/shared/03/sf_dialogcontrol.xhp#SetFocus" name="SetFocus method">SetFocus</link><br/>
- <link href="text/sbasic/shared/03/sf_dialogcontrol.xhp#WriteLine" name="WriteLine method">WriteLine</link>
+ <link href="text/sbasic/shared/03/sf_dialogcontrol.xhp#SetTableData" name="SetTableData method">SetTableData</link><br/>
+ <link href="text/sbasic/shared/03/sf_dialogcontrol.xhp#WriteLine" name="WriteLine method">WriteLine</link><br/><br/>
</paragraph></tablecell>
</tablerow>
</table>
- <embed href="text/sbasic/shared/03/avail_release.xhp#7.2.methods"/>
- <section id="AddSubNode">
- <comment> AddSubNode -------------------------------------------------------------------------------------------------------------------------- </comment>
+<section id="AddSubNode">
+ <comment> AddSubNode -------------------------------------------------------------------------------------------- </comment>
<bookmark localize="false" branch="index" id="bm_id1516127118236">
<bookmark_value>DialogControl service;AddSubNode</bookmark_value>
</bookmark>
@@ -979,16 +988,19 @@
<section id="OnNodeExpanded">
<paragraph role="paragraph" id="par_id741612711823706" xml-lang="en-US">This method may be called before displaying the dialog box to build the initial tree. It may also be called from a dialog or control event - using the <literal>OnNodeExpanded</literal> event - to complete the tree dynamically.</paragraph>
</section>
- <h3 id="hd_id841612711823995" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functsyntax"/></h3>
- <paragraph role="paragraph" localize="false" id="par_id781620224364283"><input>svc.AddSubNode(parentnode: uno, displayvalue: str, opt datavalue: any): uno</input></paragraph>
- <h3 id="hd_id261612711823446" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functparameters"/></h3>
+ <embed href="text/sbasic/shared/00000003.xhp#functsyntax"/>
+ <paragraph role="paragraph" localize="false" id="par_id781620224364283">
+ <input>svc.AddSubNode(parentnode: uno, displayvalue: str, opt datavalue: any): uno</input>
+ </paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functparameters"/>
<paragraph role="paragraph" id="par_id761612711823834"><emph>parentnode</emph>: A node UNO object, of type <literal>com.sun.star.awt.tree.XMutableTreeNode</literal>.</paragraph>
<paragraph role="paragraph" id="par_id791612711823819"><emph>displayvalue</emph>: The text appearing in the tree control box.</paragraph>
<section id="datavalue">
<paragraph role="paragraph" id="par_id911612711823382"><emph>datavalue</emph>: Any value associated with the new node. <literal>datavalue</literal> may be a string, a number or a date. Omit the argument when not applicable.</paragraph>
</section>
- <h3 id="hd_id931612711823178" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functexample"/></h3>
+ <embed href="text/sbasic/shared/00000003.xhp#functexample"/>
<paragraph role="paragraph" id="par_id901620317110685">%PRODUCTNAME Basic and Python examples pick up current document's <literal>myDialog</literal> dialog from <literal>Standard</literal> library.</paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#In_Basic"/>
<bascode>
<paragraph role="bascode" localize="false" id="bas_id781612711823502">Dim oDlg As Object, myTree As Object, myNode As Object, theRoot As Object</paragraph>
<paragraph role="bascode" localize="false" id="bas_id811612711823106">Set oDlg = CreateScriptService("Dialog",,, "myDialog")</paragraph>
@@ -996,25 +1008,28 @@
<paragraph role="bascode" localize="false" id="bas_id31612711823423">Set theRoot = myTree.CreateRoot("Tree top")</paragraph>
<paragraph role="bascode" localize="false" id="bas_id211612712366538">Set myNode = myTree.AddSubNode(theRoot, "A branch ...")</paragraph>
</bascode>
+ <embed href="text/sbasic/shared/00000003.xhp#In_Python"/>
<pycode>
<paragraph role="pycode" localize="false" id="pyc_id771620316787550">dlg = CreateScriptService('SFDialogs.Dialog', None, None, 'myDialog')</paragraph>
<paragraph role="pycode" localize="false" id="pyc_id511620316787792">tree = dlg.Controls('myTreeControl')</paragraph>
<paragraph role="pycode" localize="false" id="pyc_id291620316787950">root = tree.CreateRoot('Tree top')</paragraph>
<paragraph role="pycode" localize="false" id="pyc_id201620316788142">node = tree.AddSubNode(root, 'A branch ...')</paragraph>
</pycode>
- </section>
+</section>
- <section id="AddSubTree">
- <comment> AddSubTree -------------------------------------------------------------------------------------------------------------------------- </comment>
+<section id="AddSubTree">
+ <comment> AddSubTree -------------------------------------------------------------------------------------------- </comment>
<bookmark localize="false" branch="index" id="bm_id481612713087784">
<bookmark_value>DialogControl service;AddSubTree</bookmark_value>
</bookmark>
<h2 id="hd_id81161271308746" localize="false">AddSubTree</h2>
<paragraph role="paragraph" id="par_id221612713087885">Return <literal>True</literal> when a subtree, subordinate to a parent node, could be inserted successfully in a tree control. If the parent node had already child nodes before calling this method, the child nodes are erased.</paragraph>
<embed href="text/sbasic/shared/03/sf_dialogcontrol.xhp#OnNodeExpanded"/>
- <h3 id="hd_id781612713087790" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functsyntax"/></h3>
- <paragraph role="paragraph" localize="false" id="par_id731620308640671"><input>svc.AddSubTree(parentnode: uno, flattree: any, opt withdatavalue: bool): bool</input></paragraph>
- <h3 id="hd_id791612713087478" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functparameters"/></h3>
+ <embed href="text/sbasic/shared/00000003.xhp#functsyntax"/>
+ <paragraph role="paragraph" localize="false" id="par_id731620308640671">
+ <input>svc.AddSubTree(parentnode: uno, flattree: any, opt withdatavalue: bool): bool</input>
+ </paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functparameters"/>
<paragraph role="paragraph" id="par_id781612713087722"><emph>parentnode</emph>: A node UNO object, of type <literal>com.sun.star.awt.tree.XMutableTreeNode</literal>.</paragraph>
<paragraph role="paragraph" id="par_id36161271308759"><emph>flattree</emph>: a two dimension array sorted on the columns containing the display values. Such an array can be issued by the <literal>GetRows</literal> method applied on the <literal>SFDatabases.Database</literal> service. When an array item containing the text to be displayed is <literal>Empty</literal> or <literal>Null</literal>, no new subnode is created and the remainder of the row is skipped.</paragraph>
<bascode>
@@ -1034,7 +1049,8 @@
<paragraph role="bascode" localize="false" id="bas_id212612716132791"> |__ C6</paragraph>
</bascode>
<paragraph role="paragraph" id="par_id51612713087915"><emph>withdatavalue</emph>: When <literal>False</literal> default value is used, every column of <literal>flattree</literal> contains the text to be displayed in the tree control. When <literal>True</literal>, the texts to be displayed (<literal>displayvalue</literal>) are in columns 0, 2, 4, ... while the data values (<literal>datavalue</literal>) are in columns 1, 3, 5, ...</paragraph>
- <h3 id="hd_id781612713087851" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functexample"/></h3>
+ <embed href="text/sbasic/shared/00000003.xhp#functexample"/>
+ <embed href="text/sbasic/shared/00000003.xhp#In_Basic"/>
<bascode>
<paragraph role="bascode" localize="false" id="bas_id531612713087285">Dim myTree As Object, theRoot As Object, oDb As Object, vData As Variant</paragraph>
<paragraph role="bascode" localize="false" id="bas_id991612713087724">Set myTree = myDialog.Controls("myTreeControl")</paragraph>
@@ -1045,6 +1061,7 @@
<paragraph role="bascode" localize="false" id="bas_id551612714139429"> &amp; "ORDER BY [Category].[Name], [Product].[Name]")</paragraph>
<paragraph role="bascode" localize="false" id="bas_id361612714193588">myTree.AddSubTree(theRoot, vData, WithDataValue := True)</paragraph>
</bascode>
+ <embed href="text/sbasic/shared/00000003.xhp#In_Python"/>
<pycode>
<paragraph role="pycode" localize="false" id="pyc_id671620317364456">SQL_STMT = "SELECT [Category].[Name], [Category].[ID], [Product].[Name], [Product].[ID] \</paragraph>
<paragraph role="pycode" localize="false" id="pyc_id51620317364911"> FROM [Category], [Product] WHERE [Product].[CategoryID] = [Category].[ID] \</paragraph>
@@ -1055,35 +1072,39 @@
<paragraph role="pycode" localize="false" id="pyc_id911620317364071">sub_tree = db.GetRows(SQL_STMT)</paragraph>
<paragraph role="pycode" localize="false" id="pyc_id221620317364271">tree.AddSubTree(root, sub_tree, withdatavalue=True)</paragraph>
</pycode>
- </section>
+</section>
- <section id="CreateRoot">
- <comment> CreateRoot -------------------------------------------------------------------------------------------------------------------------- </comment>
+<section id="CreateRoot">
+ <comment> CreateRoot ------------------------------------------------------------------------------------------- </comment>
<bookmark localize="false" branch="index" id="bm_id791612780723864">
<bookmark_value>DialogControl service;CreateRoot</bookmark_value>
</bookmark>
<h2 id="hd_id291612780723671" localize="false">CreateRoot</h2>
<paragraph role="paragraph" id="par_id151612780723320">Returns a new root node of the tree control, as a node UNO object of type <literal>com.sun.star.awt.tree.XMutableTreeNode</literal>. The new tree root is inserted below pre-existing root nodes. <embedvar href="text/sbasic/shared/03/sf_dialogcontrol.xhp#XMutableTreeNode"/></paragraph>
<paragraph role="paragraph" id="par_id821612780723965" xml-lang="en-US">This method may be called before displaying the dialog box to build the initial tree. It may also be called from a dialog or control event to complete the tree dynamically.</paragraph>
- <h3 id="hd_id211612780723578" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functsyntax"/></h3>
- <paragraph role="paragraph" localize="false" id="par_id991620309297239"><input>svc.CreateRoot(displayvalue: str, opt datavalue: any): uno</input></paragraph>
- <h3 id="hd_id871612780723668" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functparameters"/></h3>
+ <embed href="text/sbasic/shared/00000003.xhp#functsyntax"/>
+ <paragraph role="paragraph" localize="false" id="par_id991620309297239">
+ <input>svc.CreateRoot(displayvalue: str, opt datavalue: any): uno</input>
+ </paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functparameters"/>
<paragraph role="paragraph" id="par_id791612117823819"><emph>displayvalue</emph>: The text appearing in the tree control box.</paragraph>
<embed href="text/sbasic/shared/03/sf_dialogcontrol.xhp#datavalue"/>
- <h3 id="hd_id241612780723961" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functexample"/></h3>
+ <embed href="text/sbasic/shared/00000003.xhp#functexample"/>
+ <embed href="text/sbasic/shared/00000003.xhp#In_Basic"/>
<bascode>
<paragraph role="bascode" localize="false" id="bas_id491612780723925">Dim myTree As Object, myNode As Object</paragraph>
<paragraph role="bascode" localize="false" id="bas_id241612780723722">Set myTree = myDialog.Controls("myTreeControl")</paragraph>
<paragraph role="bascode" localize="false" id="bas_id441612780723817">Set myNode = myTree.CreateRoot("Tree starts here ...")</paragraph>
</bascode>
+ <embed href="text/sbasic/shared/00000003.xhp#In_Python"/>
<pycode>
<paragraph role="pycode" localize="false" id="pyc_id441620318437138">tree = dlg.Controls('myTreeControl')</paragraph>
<paragraph role="pycode" localize="false" id="pyc_id301620318437324">node = tree.CreateRoot('Tree starts here ...')</paragraph>
</pycode>
- </section>
+</section>
- <section id="FindNode">
- <comment> FindNode -------------------------------------------------------------------------------------------------------------------------- </comment>
+<section id="FindNode">
+ <comment> FindNode ---------------------------------------------------------------------------------------------- </comment>
<bookmark localize="false" branch="index" id="bm_id741612781589926">
<bookmark_value>DialogControl service;FindNode</bookmark_value>
</bookmark>
@@ -1091,82 +1112,159 @@
<paragraph role="paragraph" id="par_id171612781589503">Traverses the tree and finds recursively, starting from the root, a node meeting some criteria. Either - 1 match is enough - having its display value matching <literal>displayvalue</literal> pattern or having its data value equal to <literal>datavalue</literal>. The comparisons may be or not case-sensitive. The first matching occurrence is returned as a node UNO object of type <literal>com.sun.star.awt.tree.XMutableTreeNode</literal>. <embedvar href="text/sbasic/shared/03/sf_dialogcontrol.xhp#XMutableTreeNode"/></paragraph>
<paragraph role="paragraph" id="par_id741612782475457" xml-lang="en-US">When not found, the method returns <literal>Nothing</literal>, to be tested with the <literal>IsNull()</literal> builtin function.</paragraph>
<paragraph role="paragraph" id="par_id41612781589363" xml-lang="en-US">This method may be called before displaying the dialog box to build the initial tree. It may also be called from a dialog or control event.</paragraph>
- <h3 id="hd_id60161278158981" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functsyntax"/></h3>
- <paragraph role="paragraph" localize="false" id="par_id61620309668544"><input>svc.FindNode(displayvalue: str = '', opt datavalue: any, casesensitive = False): uno</input></paragraph>
- <h3 id="hd_id771612781589667" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functparameters"/></h3>
+ <embed href="text/sbasic/shared/00000003.xhp#functsyntax"/>
+ <paragraph role="paragraph" localize="false" id="par_id61620309668544">
+ <input>svc.FindNode(displayvalue: str = '', opt datavalue: any, casesensitive = False): uno</input>
+ </paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functparameters"/>
<paragraph role="paragraph" id="par_id541613670199211">One argument out of <literal>displayvalue</literal> or <literal>datavalue</literal> must be specified. If both present, one match is sufficient to select the node.</paragraph>
<paragraph role="paragraph" id="par_id591612781589560"><emph>displayvalue</emph>: The pattern to be matched. Refer to <link href="text/sbasic/shared/03/sf_string.xhp#IsLike" name="String service IsLike() method"><literal>SF_String.IsLike()</literal></link> method for the list of possible wildcards. When equal to the zero-length string (default), this display value is not searched for.</paragraph>
<embed href="text/sbasic/shared/03/sf_dialogcontrol.xhp#datavalue"/>
<paragraph role="paragraph" id="par_id141582384726168"><emph>casesensitive</emph>: Default value is <literal>False</literal></paragraph>
- <h3 id="hd_id41612781589546" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functexample"/></h3>
+ <embed href="text/sbasic/shared/00000003.xhp#functexample"/>
+ <embed href="text/sbasic/shared/00000003.xhp#In_Basic"/>
<bascode>
<paragraph role="bascode" localize="false" id="bas_id61612781589464">Dim myTree As Object, myNode As Object</paragraph>
<paragraph role="bascode" localize="false" id="bas_id991612781589903">Set myTree = myDialog.Controls("myTreeControl")</paragraph>
<paragraph role="bascode" localize="false" id="bas_id461612781589942">Set myNode = myTree.FindNode("*Sophie*", CaseSensitive := True)</paragraph>
</bascode>
+ <embed href="text/sbasic/shared/00000003.xhp#In_Python"/>
<pycode>
<paragraph role="pycode" localize="false" id="pyc_id191620318816450">tree = dlg.Controls('myTreeControl')</paragraph>
<paragraph role="pycode" localize="false" id="pyc_id281620318817089">node = FindNode('*Sophie*', casesensitive=True)</paragraph>
<paragraph role="pycode" localize="false" id="pyc_id861620319785763">if node is None:</paragraph>
<paragraph role="pycode" localize="false" id="pyc_id471620319809524"> # ...</paragraph>
</pycode>
- </section>
- <section id="SetFocus">
- <comment> SetFocus -------------------------------------------------------------------------------------------------------------------------- </comment>
+</section>
+
+<section id="SetFocus">
+ <comment> SetFocus ---------------------------------------------------------------------------------------------- </comment>
<bookmark localize="false" branch="index" id="bm_id721583933076548">
<bookmark_value>DialogControl service;SetFocus</bookmark_value>
</bookmark>
<h2 id="hd_id681583933076692" localize="false">SetFocus</h2>
<paragraph role="paragraph" id="par_id871583933076448">Set the focus on the control. Return <literal>True</literal> if focusing was successful.</paragraph>
<paragraph role="paragraph" id="par_id151598178880227" xml-lang="en-US">This method is often called from a dialog or control event.</paragraph>
- <h3 id="hd_id61583933076171" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functsyntax"/></h3>
- <paragraph role="paragraph" localize="false" id="par_id11620310325234"><input>svc.SetFocus(): bool</input></paragraph>
- <h3 id="hd_id26158393307687" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functexample"/></h3>
+ <embed href="text/sbasic/shared/00000003.xhp#functsyntax"/>
+ <paragraph role="paragraph" localize="false" id="par_id11620310325234">
+ <input>svc.SetFocus(): bool</input>
+ </paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functexample"/>
+ <embed href="text/sbasic/shared/00000003.xhp#In_Basic"/>
<bascode>
<paragraph role="bascode" localize="false" id="bas_id221598179105596">Dim oControl As Object</paragraph>
<paragraph role="bascode" localize="false" id="bas_id171598179111121">Set oDlg = CreateScriptService("SFDialogs.Dialog",,, "myDialog")</paragraph>
<paragraph role="bascode" localize="false" id="bas_id681598179123436">Set oControl = oDlg.Controls("thisControl")</paragraph>
<paragraph role="bascode" localize="false" id="bas_id361598179135096">oControl.SetFocus()</paragraph>
</bascode>
+ <embed href="text/sbasic/shared/00000003.xhp#In_Python"/>
<pycode>
<paragraph role="pycode" localize="false" id="pyc_id591620319169802">dlg = CreateScriptService('Dialog', None, None, 'myDialog')</paragraph>
<paragraph role="pycode" localize="false" id="pyc_id201620319170298">ctrl = dlg.Controls('thisControl')</paragraph>
<paragraph role="pycode" localize="false" id="pyc_id821620319170682">ctrl.SetFocus()</paragraph>
</pycode>
- </section>
- <section id="WriteLine">
- <comment> WriteLine -------------------------------------------------------------------------------------------------------------------------- </comment>
+</section>
+
+<section id="SetTableData">
+ <comment> SetTableData ------------------------------------------------------------------------------------------ </comment>
+ <bookmark localize="false" branch="index" id="bm_id761598619892024">
+ <bookmark_value>DialogControl service;SetTableData</bookmark_value>
+ </bookmark>
+ <h2 id="hd_id961598619890364" localize="false">SetTableData</h2>
+ <paragraph role="paragraph" id="par_id541638553960464">Fills a <literal>TableControl</literal> with the given data. All preexisting data is cleared before inserting the new data passed as argument.</paragraph>
+ <paragraph role="paragraph" id="par_id551638554058131">When the <literal>TableControl</literal> is added to the dialog, it is possible to use the Basic IDE to define whether column and row headers will be shown in the table. If the <literal>TableControl</literal> has column and/or row headers, the first column and/or row in the provided data array are used as labels for the table headers.</paragraph>
+ <paragraph role="paragraph" id="par_id411638569396108">This method returns <literal>True</literal> when successful.</paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functsyntax"/>
+ <paragraph role="paragraph" localize="false" id="par_id841620310380255">
+ <input>svc.SetTableData(dataarray: any[0..*, 0..*], widths: int[0..*], alignments: str): bool</input>
+ </paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functparameters"/>
+ <paragraph role="paragraph" id="par_id1001584541257133"><emph>dataarray</emph>: Data to be entered into the table represented as an Array of Arrays in Basic or a tuple of tuples in Python. The data must include column and row headers if they are to be displayed by the <literal>TableControl</literal>.</paragraph>
+ <paragraph role="paragraph" id="par_id1001584541257025"><emph>widths</emph>: Array containing the relative widths of each column. In other words, <literal>widths = Array(1, 2)</literal> means that the second column is twice as wide as the first one. If the number of values in the array is smaller than the number of columns in the table, then the last value in the array is used to define the width of the remaining columns.</paragraph>
+ <paragraph role="paragraph" id="par_id1001584541257007"><emph>alignments</emph>: Defines the alignment in each column as a string in which each character can be "L" (Left), "C" (Center), "R" (Right) or " " (whitespace, default, meaning left for strings and right for numeric values). If the length of the string is shorter than the number of columns in the table, then the last character in the string is used to define the alignment of the remaining columns.</paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functexample"/>
+ <embed href="text/sbasic/shared/00000003.xhp#In_Basic"/>
+ <paragraph role="paragraph" id="par_id381638569172413">The following example assumes that the dialog <literal>myDialog</literal> has a <literal>TableControl</literal> named <literal>Grid1</literal> with "Show header row" and "Show column row" properties set to "Yes".</paragraph>
+ <bascode>
+ <paragraph role="bascode" localize="false" id="bas_id901638569052132">Dim myDialog As Object, oTable As Object, tableData As Variant</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id781638569039123">myDialog = CreateScriptService("Dialog", "GlobalScope", "Standard", "myDialog")</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id281638569051918">oTable = myDialog.Controls("Grid1")</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id361638569052324">tableData = Array("Column A", "Column B", "Column C")</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id291638569052525">tableData = SF_Array.AppendRow(tableData, Array("Row 1", 1, 2))</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id631638569052740">tableData = SF_Array.AppendRow(tableData, Array("Row 2", 3, 4))</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id371638569052941">tableData = SF_Array.AppendRow(tableData, Array("Row 3", 5, 6))</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id781638569053179">vAlignments = "LCC"</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id181638569053413">vWidths = Array(2, 1, 1)</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id191638569053613">oTable.SetTableData(tableData, vWidths, vAlignments)</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id981638569053837">myDialog.Execute()</paragraph>
+ </bascode>
+ <paragraph role="paragraph" id="par_id171638650502346">The <literal>Value</literal> property returns the selected row in the table. If no row is selected, an empty Array object is returned. The following code snippet shows how to test if any row is selected in the table.</paragraph>
+ <bascode>
+ <paragraph role="bascode" localize="false" id="bas_id891638651540245">rowValues = oTable.Value</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id431638651540427">If UBound(rowValues) &lt; 0 Then</paragraph>
+ <paragraph role="bascode" id="bas_id361638651540588"> MsgBox "No row selected."</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id121638651540820">Else</paragraph>
+ <paragraph role="bascode" id="bas_id781638651541028"> MsgBox "Row " &amp; oTable.ListIndex &amp; " is selected."</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id601638651541333">End If</paragraph>
+ </bascode>
+ <embed href="text/sbasic/shared/00000003.xhp#In_Python"/>
+ <pycode>
+ <paragraph role="pycode" id="pyc_id111638569958471">dlg = CreateScriptService("Dialog", "GlobalScope", "Standard", "myDialog")</paragraph>
+ <paragraph role="pycode" localize="false" id="pyc_id871638569958742">table_control = dlg.Controls("Grid1")</paragraph>
+ <paragraph role="pycode" localize="false" id="pyc_id141638569958918">table_data = (("Column A", "Column B", "Column C"),</paragraph>
+ <paragraph role="pycode" localize="false" id="pyc_id616385699590945"> ("Row 1", 1, 2),</paragraph>
+ <paragraph role="pycode" localize="false" id="pyc_id991638569959270"> ("Row 2", 3, 4),</paragraph>
+ <paragraph role="pycode" localize="false" id="pyc_id381638569959454"> ("Row 3", 5, 6))</paragraph>
+ <paragraph role="pycode" localize="false" id="pyc_id251638569959654">alignments = "LCC"</paragraph>
+ <paragraph role="pycode" localize="false" id="pyc_id971638569959870">widths = (100, 50, 50)</paragraph>
+ <paragraph role="pycode" localize="false" id="pyc_id571638569960094">table_control.SetTableData(table_data, widths, alignments)</paragraph>
+ <paragraph role="pycode" localize="false" id="pyc_id601638569960326">dlg.Execute()</paragraph>
+ </pycode>
+ <pycode>
+ <paragraph role="pycode" localize="false" id="pyc_id311638651802570">bas = CreateScriptService("Basic")</paragraph>
+ <paragraph role="pycode" localize="false" id="pyc_id121638651802186">row_values = table_control.Value</paragraph>
+ <paragraph role="pycode" localize="false" id="pyc_id216386518024106">if len(row_values) == 0:</paragraph>
+ <paragraph role="pycode" localize="false" id="pyc_id941638651802762"> bas.MsgBox("No row selected.")</paragraph>
+ <paragraph role="pycode" localize="false" id="pyc_id491638651803057">else:</paragraph>
+ <paragraph role="pycode" localize="false" id="pyc_id261638651804210"> bas.MsgBox(f"Row {table_control.ListIndex} is selected.")</paragraph>
+ </pycode>
+</section>
+
+<section id="WriteLine">
+ <comment> WriteLine -------------------------------------------------------------------------------------------- </comment>
<bookmark localize="false" branch="index" id="bm_id761598619892798">
<bookmark_value>DialogControl service;WriteLine</bookmark_value>
</bookmark>
<h2 id="hd_id961598619892816" localize="false">WriteLine</h2>
<paragraph role="paragraph" id="par_id671598619892378">Add a new line at the end of a multiline text field. A newline character will be inserted when appropriate. The method returns <literal>True</literal> when successful.</paragraph>
<paragraph role="paragraph" id="par_id941598619892915" xml-lang="en-US">An error is raised if the actual control is not of the type <literal>TextField</literal> or is not multiline.</paragraph>
- <h3 id="hd_id761598619892682" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functsyntax"/></h3>
- <paragraph role="paragraph" localize="false" id="par_id841620310387185"><input>svc.WriteLine(opt line: str): bool</input></paragraph>
- <bascode>
- <paragraph role="bascode" localize="false" id="bas_id821598619892939">oControl.WriteLine([Line As String]) As Boolean</paragraph>
- </bascode>
- <h3 id="hd_id291584541257237" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functparameters"/></h3>
+ <embed href="text/sbasic/shared/00000003.xhp#functsyntax"/>
+ <paragraph role="paragraph" localize="false" id="par_id841620310387185">
+ <input>svc.WriteLine(opt line: str): bool</input>
+ </paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functparameters"/>
<paragraph role="paragraph" id="par_id1001584541257789"><emph>Line</emph>: The string to insert. Default is an empty line.</paragraph>
- <h3 id="hd_id391598619892559" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functexample"/></h3>
+ <embed href="text/sbasic/shared/00000003.xhp#functexample"/>
+ <embed href="text/sbasic/shared/00000003.xhp#In_Basic"/>
<bascode>
<paragraph role="bascode" localize="false" id="bas_id681598619892624">Dim oDlg As Object, oControl As Object</paragraph>
<paragraph role="bascode" localize="false" id="bas_id521598619892148">Set oDlg = CreateScriptService("SFDialogs.Dialog",,, "myDialog")</paragraph>
<paragraph role="bascode" localize="false" id="bas_id391598619892465">Set oControl = oDlg.Controls("thisControl")</paragraph>
<paragraph role="bascode" localize="false" id="bas_id281598619892850">oControl.WriteLine("a new line")</paragraph>
</bascode>
+ <embed href="text/sbasic/shared/00000003.xhp#In_Python"/>
<pycode>
<paragraph role="pycode" localize="false" id="pyc_id61620319410491">dlg = CreateScriptService('SFDialogs.Dialog', None, None, 'myDialog')</paragraph>
<paragraph role="pycode" localize="false" id="pyc_id701620319411995">ctrl = dlg.Controls('thisControl')</paragraph>
<paragraph role="pycode" localize="false" id="pyc_id591620319412507">ctr.WriteLine("a new line")</paragraph>
</pycode>
- </section>
- <embed href="text/sbasic/shared/03/lib_ScriptForge.xhp#SF_InternalUse"/>
- <section id="relatedtopics">
- <embed href="text/sbasic/shared/03/sf_dialog.xhp#dlg_h1"/>
- <embed href="text/sbasic/shared/03/sf_string.xhp#StringService"/>
- <embed href="text/sbasic/shared/03/sf_ui.xhp#UIService"/>
- </section>
+</section>
+
+ <embed href="text/sbasic/shared/03/lib_ScriptForge.xhp#SF_InternalUse"/>
+ <section id="relatedtopics">
+ <embed href="text/sbasic/shared/03/sf_dialog.xhp#dlg_h1"/>
+ <embed href="text/sbasic/shared/03/sf_string.xhp#StringService"/>
+ <embed href="text/sbasic/shared/03/sf_ui.xhp#UIService"/>
+ </section>
</body>
-</helpdocument> \ No newline at end of file
+</helpdocument>