summaryrefslogtreecommitdiffstats
path: root/source/text/sbasic/shared/03/sf_ui.xhp
diff options
context:
space:
mode:
authorRafael Lima <rafael.palma.lima@gmail.com>2021-05-06 22:55:29 +0200
committerJean-Pierre Ledure <jp@ledure.be>2021-05-15 10:02:10 +0200
commitc998e3e9419895a15c87412b5bd8efdbb18e0c0c (patch)
tree83fff62dd6db476b07531d718ff3302b246b2729 /source/text/sbasic/shared/03/sf_ui.xhp
parentFix =FIXED() example (diff)
downloadhelp-c998e3e9419895a15c87412b5bd8efdbb18e0c0c.tar.gz
help-c998e3e9419895a15c87412b5bd8efdbb18e0c0c.zip
Python support in the SF_UI help page
Change-Id: I3d5614d7f2ae24a15718237d817527a4d7421aa0 Reviewed-on: https://gerrit.libreoffice.org/c/help/+/115199 Tested-by: Jenkins Tested-by: Jean-Pierre Ledure <jp@ledure.be> Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Diffstat (limited to 'source/text/sbasic/shared/03/sf_ui.xhp')
-rw-r--r--source/text/sbasic/shared/03/sf_ui.xhp458
1 files changed, 303 insertions, 155 deletions
diff --git a/source/text/sbasic/shared/03/sf_ui.xhp b/source/text/sbasic/shared/03/sf_ui.xhp
index f776c6e369..6ef7fff8b1 100644
--- a/source/text/sbasic/shared/03/sf_ui.xhp
+++ b/source/text/sbasic/shared/03/sf_ui.xhp
@@ -23,7 +23,7 @@
<h1 id="hd_id371587913266310" xml-lang="en-US"><variable id="UIService"><link href="text/sbasic/shared/03/sf_ui.xhp" name="ScriptForge.UI service"><literal>ScriptForge</literal>.<literal>UI</literal> service</link></variable></h1>
-<paragraph role="paragraph" xml-lang="en-US" id="par_id31587913266153">The UI (User Interface) service simplifies the identification and the manipulation of the different windows composing the whole LibreOffice application:</paragraph>
+<paragraph role="paragraph" xml-lang="en-US" id="par_id31587913266153">The UI (User Interface) service simplifies the identification and the manipulation of the different windows composing the whole %PRODUCTNAME application:</paragraph>
<list type="unordered">
<listitem>
<paragraph role="listitem" id="par_id591587913266547" xml-lang="en-US">Windows selection</paragraph>
@@ -46,11 +46,11 @@
</list>
</section>
-<paragraph role="tip" xml-lang="en-US" id="par_id421587913266819">The UI service is the starting point to open, create or access to the content of new or existing documents from a user script.
-</paragraph>
+<tip id="par_id181620312953395">The UI service is the starting point to open, create or access to the content of new or existing documents from a user script.</tip>
<h2 id="hd_id881587913266307">Definitions</h2>
+<section id="WindowName">
<h3 id="hd_id761587913266887" localize="false">WindowName</h3>
<paragraph role="paragraph" id="par_id741587913266919">A window can be designated using various ways:</paragraph>
<list type="unordered">
@@ -72,16 +72,23 @@
</list>
<paragraph role="paragraph" id="par_id181587914255236" xml-lang="en-US">The window name is case-sensitive.</paragraph>
<h3 id="hd_id541588520711430" xml-lang="en-US">Document object</h3>
+</section>
<paragraph role="paragraph" id="par_id841588521238711" xml-lang="en-US">The methods <literal>CreateDocument</literal>, <literal>CreateBaseDocument</literal>, <literal>GetDocument</literal> and <literal>OpenDocument</literal>, described below, generate document objects. When a window contains a document, an instance of the <literal>Document</literal> class represents that document. A counterexample the Basic IDE is not a document but is a window in our terminology. Additionally a document has a type: <literal>Calc</literal>, <literal>Impress</literal>, <literal>Writer</literal>, ...</paragraph>
<paragraph role="paragraph" id="par_id331588521254916" xml-lang="en-US">The specific properties and methods applicable on documents are implemented in a document class.</paragraph>
<tip id="par_id971588521292976" xml-lang="en-US">The implementation of the document objects class is done in the <literal>SFDocuments</literal> associated library. See its "<literal>Document</literal>" service.</tip>
<h2 id="hd_id91587913266988" xml-lang="en-US">Service invocation</h2>
- <bascode>
- <paragraph role="bascode" localize="false" id="bas_id391587913266269">Dim ui As Variant</paragraph>
- <paragraph role="bascode" localize="false" id="bas_id851582897798335"> GlobalScope.BasicLibraries.loadLibrary("ScriptForge")</paragraph>
- <paragraph role="bascode" localize="false" id="bas_id1001587913266355"> Set ui = CreateScriptService("UI")</paragraph>
- </bascode>
+ <embed href="text/sbasic/shared/00000003.xhp#In_Basic"/>
+ <bascode>
+ <paragraph role="bascode" localize="false" id="bas_id391587913266269">Dim ui As Variant</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id851582897798335">GlobalScope.BasicLibraries.LoadLibrary("ScriptForge")</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id1001587913266355">Set ui = CreateScriptService("UI")</paragraph>
+ </bascode>
+ <embed href="text/sbasic/shared/00000003.xhp#In_Python"/>
+ <pycode>
+ <paragraph role="pycode" localize="false" id="pyc_id61620310677393">from scriptforge import CreateScriptService</paragraph>
+ <paragraph role="pycode" localize="false" id="pyc_id601620310674922">svcUI = CreateScriptService("UI")</paragraph>
+ </pycode>
<h2 id="hd_id841587913266618" xml-lang="en-US">Properties</h2>
<table id="tab_id291587913266435">
@@ -129,14 +136,76 @@
</tablerow>
</table>
- <h3 id="hd_id891587985839528" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functexample"/></h3>
+<section id="Constants">
+<h2 id="hd_id511620762163390">Constants</h2>
+<table id="tab_id51620761856238">
+ <tablerow>
+ <tablecell>
+ <paragraph id="par_id761620761856238" role="tablehead">Name</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id591620761856238" role="tablehead">Value</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id711620761856238" role="tablehead">Description</paragraph>
+ </tablecell>
+ </tablerow>
+ <tablerow>
+ <tablecell>
+ <paragraph id="par_id511620761856238" role="tablecontent">MACROEXECALWAYS</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id761620761856107" role="tablecontent">2</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id341620761856238" role="tablecontent">Macros are always executed</paragraph>
+ </tablecell>
+ </tablerow>
+ <tablerow>
+ <tablecell>
+ <paragraph id="par_id661620761881513" role="tablecontent">MACROEXECNEVER</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id661620761891082" role="tablecontent">1</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id101620761893011" role="tablecontent">Macros are never executed</paragraph>
+ </tablecell>
+ </tablerow>
+ <tablerow>
+ <tablecell>
+ <paragraph id="par_id311620761888379" role="tablecontent">MACROEXECNORMAL</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id951620761899067" role="tablecontent">0</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id11620761899780" role="tablecontent">Macro execution depends on user settings</paragraph>
+ </tablecell>
+ </tablerow>
+</table>
+</section>
+
+ <embed href="text/sbasic/shared/00000003.xhp#functexample"/>
+ <paragraph role="paragraph" id="par_id311620312548992">The examples below show a <literal>MsgBox</literal> with the names of all currently open documents.</paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#In_Basic"/>
<bascode>
- <paragraph role="bascode" localize="false" id="bas_id201587985861232">Dim vDocs As Variant, sDoc As String</paragraph>
- <paragraph role="bascode" localize="false" id="bas_id261587985839734">vDocs = ui.Documents()</paragraph>
- <paragraph role="bascode" localize="false" id="bas_id621587985950181">For each sDoc In vDocs</paragraph>
- <paragraph role="bascode" localize="false" id="bas_id11587985956383"> ' ...</paragraph>
- <paragraph role="bascode" localize="false" id="bas_id341587985962974">Next sDoc</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id201587985861232">Dim openDocs as Object, strDocs as String</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id261587985839734">Set openDocs = ui.Documents()</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id621587985950181">strDocs = openDocs(0)</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id11587985956383">For i = 1 to UBound(openDocs)</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id981620312219531"> strDocs = strDocs &amp; Chr(10) &amp; openDocs(i)</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id341587985962974">Next i</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id191620312244070">MsgBox strDocs</paragraph>
</bascode>
+ <embed href="text/sbasic/shared/00000003.xhp#In_Python"/>
+ <pycode>
+ <paragraph role="pycode" id="pyc_id21620312350189">svcUI = CreateScriptService("UI")</paragraph>
+ <paragraph role="pycode" id="pyc_id631620312351013">sBasic = CreateScriptService("Basic")</paragraph>
+ <paragraph role="pycode" id="pyc_id141620312351286">openDocs = svcUI.Documents()</paragraph>
+ <paragraph role="pycode" id="pyc_id661620312351500">strDocs = "\n".join(openDocs)</paragraph>
+ <paragraph role="pycode" id="pyc_id801620312351676">sBasic.MsgBox(strDocs)</paragraph>
+ </pycode>
<table id="tab_id891606472825856">
<tablerow>
@@ -163,272 +232,351 @@
</paragraph></tablecell>
</tablerow>
</table>
+<warning id="par_id431620322170443">Note, as an exception, that the methods marked <emph>(*)</emph> are <emph>not applicable to Base documents</emph>.</warning>
- <paragraph xml-lang="en-US" id="par_id811596553490262" role="warning">Note, as an exception, that the methods marked <emph>(*)</emph> are <emph>not applicable to Base documents</emph>.</paragraph>
-
- <section id="Activate">
+<section id="Activate">
<comment> Activate -------------------------------------------------------------------------------------------------------------------------- </comment>
<bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id991587913266189">
<bookmark_value>UI service;Activate</bookmark_value>
</bookmark>
<h2 id="hd_id76158791326673" localize="false">Activate</h2>
<paragraph role="paragraph" id="par_id201587913266596">Make the specified window active. The method returns <literal>True</literal> if the given window is found and can be activated. There is no change in the actual user interface if no window matches the selection.</paragraph>
- <h3 id="hd_id591587913266515" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functsyntax"/></h3>
- <bascode>
- <paragraph role="bascode" localize="false" id="bas_id29158791326686">ui.Activate(WindowName As String) As Boolean</paragraph>
- </bascode>
- <h3 id="hd_id781587913266640" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functparameters"/></h3>
- <paragraph role="paragraph" id="par_id381587913266946"><emph>WindowName</emph>: see the definitions above.</paragraph>
- <h3 id="hd_id14158791326646" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functexample"/></h3>
- <bascode>
- <paragraph role="bascode" localize="false" id="bas_id201587913266745">ui.Activate("C:\Me\My file.odt")</paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functsyntax"/>
+ <paragraph role="paragraph" localize="false" id="par_id331620319796672">
+ <input>svc.Activate(windowname: str): bool</input>
+ </paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functparameters"/>
+ <paragraph role="paragraph" id="par_id381587913266946"><emph>windowname</emph>: see the definitions above.</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_id201587913266745">ui.Activate("C:\Documents\My file.odt")</paragraph>
</bascode>
- </section>
+ <embed href="text/sbasic/shared/00000003.xhp#In_Python"/>
+ <pycode>
+ <paragraph role="pycode" localize="false" id="pyc_id941620322846267">svcUI.Activate(r"C:\Documents\My file.odt")</paragraph>
+ </pycode>
+</section>
- <section id="CreateBaseDocument">
+<section id="CreateBaseDocument">
<comment> CreateBaseDocument -------------------------------------------------------------------------------------------------------------------------- </comment>
<bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id871596554849122">
<bookmark_value>UI service;CreateBaseDocument</bookmark_value>
</bookmark>
<h2 id="hd_id281596554849363" localize="false">CreateBaseDocument</h2>
- <paragraph role="paragraph" id="par_id13159655484952">Create and store a new LibreOffice Base document embedding an empty database of the given type. The method returns a document object.</paragraph>
- <h3 id="hd_id461596554849371" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functsyntax"/></h3>
- <bascode>
- <paragraph role="bascode" localize="false" id="bas_id441596554849435">ui.CreateBaseDocument(FileName As String, [EmbeddedDatabase As String], [RegistrationName As String]) As Object</paragraph>
- </bascode>
- <h3 id="hd_id201596554849717" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functparameters"/></h3>
- <paragraph role="paragraph" id="par_id441596554849949"><emph>FileName</emph> : Identifies the file to create. It must follow the SF_FileSystem.FileNaming notation. If the file already exists, it is overwritten without warning</paragraph>
- <paragraph role="paragraph" id="par_id381596554849698" xml-lang="en-US"><emph>EmbeddedDatabase</emph> : Either "HSQLDB" (default) or "FIREBIRD".</paragraph>
- <paragraph role="paragraph" id="par_id521596554849185" xml-lang="en-US"><emph>RegistrationName</emph> : The name used to store the new database in the databases register. When = "" (default), no registration takes place. If the name already exists it is overwritten without warning.</paragraph>
- <h3 id="hd_id841596554849466" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functexample"/></h3>
+ <paragraph role="paragraph" id="par_id13159655484952">Creates and stores a new %PRODUCTNAME Base document embedding an empty database of the given type. The method returns a <literal>Document</literal> service instance.</paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functsyntax"/>
+ <paragraph role="paragraph" localize="false" id="par_id461620320014911">
+ <input>svc.CreateBaseDocument(filename: str, embeddeddatabase: str = 'HSQLDB', registrationname: str = ''): svc</input>
+ </paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functparameters"/>
+ <paragraph role="paragraph" id="par_id441596554849949"><emph>filename</emph> : Identifies the file to create. It must follow the <literal>SF_FileSystem.FileNaming</literal> notation. If the file already exists, it is overwritten without warning</paragraph>
+ <paragraph role="paragraph" id="par_id381596554849698" xml-lang="en-US"><emph>embeddeddatabase</emph> : Either "HSQLDB" (default) or "FIREBIRD".</paragraph>
+ <paragraph role="paragraph" id="par_id521596554849185" xml-lang="en-US"><emph>registrationname</emph> : The name used to store the new database in the databases register. When = "" (default), no registration takes place. If the name already exists it is overwritten without warning.</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_id631596554849994">Dim myBase As Object</paragraph>
<paragraph role="bascode" localize="false" id="bas_id921596554849612">Set myBase = ui.CreateBaseDocument("C:\Databases\MyBaseFile.odb", "FIREBIRD")</paragraph>
</bascode>
- </section>
+ <embed href="text/sbasic/shared/00000003.xhp#In_Python"/>
+ <pycode>
+ <paragraph role="pycode" id="pyc_id361620323808010">myBase = svcUI.CreateBaseDocument(r"C:\Databases\MyBaseFile.odb", "FIREBIRD")</paragraph>
+ </pycode>
+</section>
- <section id="CreateDocument">
+<section id="CreateDocument">
<comment> CreateDocument -------------------------------------------------------------------------------------------------------------------------- </comment>
<bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id461588521753429">
<bookmark_value>UI service;CreateDocument</bookmark_value>
</bookmark>
<h2 id="hd_id45158852175376" localize="false">CreateDocument (*)</h2>
- <paragraph role="paragraph" id="par_id651588521753997">Create a new LibreOffice document of a given type or based on a given template. The method returns a document object.</paragraph>
- <h3 id="hd_id541588521753959" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functsyntax"/></h3>
- <bascode>
- <paragraph role="bascode" localize="false" id="bas_id121588521753450">ui.CreateDocument([DocumentType As String], [TemplateFile As STring], [Hidden As Boolean]) As Object</paragraph>
- </bascode>
- <h3 id="hd_id9215885217531000" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functparameters"/></h3>
- <paragraph role="paragraph" id="par_id51588521753302"><emph>DocumentType</emph> : "Calc", "Writer", etc. If absent, the <literal>TemplateFile</literal> argument must be present.</paragraph>
- <paragraph role="paragraph" id="par_id401588522663325" xml-lang="en-US"><emph>TemplateFile</emph> : The full <literal>FileName</literal> of the template to build the new document on. If the file does not exist, the argument is ignored. The "FileSystem" service provides the <literal>TemplatesFolder</literal> and <literal>UserTemplatesFolder</literal> properties to help to build the argument.</paragraph>
- <paragraph role="paragraph" id="par_id131588522824366" xml-lang="en-US"><emph>Hidden</emph>: if <literal>True</literal>, open the new document in the background (default = False). To use with caution: activation or closure afterwards can only happen programmatically.</paragraph>
- <h3 id="hd_id421588521753716" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functexample"/></h3>
+ <paragraph role="paragraph" id="par_id651588521753997">Create a new %PRODUCTNAME document of a given type or based on a given template. The method returns a document object.</paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functsyntax"/>
+ <paragraph role="paragraph" localize="false" id="par_id401620320696126">
+ <input>svc.CreateDocument(documenttype: str = '', templatefile: str = '', hidden: bool = False): svc</input>
+ </paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functparameters"/>
+ <paragraph role="paragraph" id="par_id51588521753302"><emph>documenttype</emph> : "Calc", "Writer", etc. If absent, the <literal>TemplateFile</literal> argument must be present.</paragraph>
+ <paragraph role="paragraph" id="par_id401588522663325" xml-lang="en-US"><emph>templatefile</emph> : The full <literal>FileName</literal> of the template to build the new document on. If the file does not exist, the argument is ignored. The <literal>FileSystem</literal> service provides the <literal>TemplatesFolder</literal> and <literal>UserTemplatesFolder</literal> properties to help to build the argument.</paragraph>
+ <paragraph role="paragraph" id="par_id131588522824366" xml-lang="en-US"><emph>hidden</emph>: if <literal>True</literal>, open the new document in the background (default = <literal>False</literal>). To use with caution: activation or closure afterwards can only happen programmatically.</paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functexample"/>
+ <paragraph role="paragraph" id="par_id701620762417802">In both examples below, the first call to <literal>CreateDocument</literal> method creates a blank Calc document, whereas the second creates a document from a template file.</paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#In_Basic"/>
<bascode>
<paragraph role="bascode" localize="false" id="bas_id201588522371030">Dim myDoc1 As Object, myDoc2 As Object, FSO As Object</paragraph>
<paragraph role="bascode" localize="false" id="bas_id931588522377598">Set myDoc1 = ui.CreateDocument("Calc")</paragraph>
<paragraph role="bascode" localize="false" id="bas_id821588522387111">Set FSO = CreateScriptService("FileSystem")</paragraph>
<paragraph role="bascode" localize="false" id="bas_id661588522393007">Set myDoc2 = ui.CreateDocument(, FSO.BuildPath(FSO.TemplatesFolder, "personal/CV.ott"))</paragraph>
</bascode>
- </section>
+ <embed href="text/sbasic/shared/00000003.xhp#In_Python"/>
+ <pycode>
+ <paragraph role="pycode" localize="false" id="pyc_id901620324433095">myDoc1 = svcUI.CreateDocument("Calc")</paragraph>
+ <paragraph role="pycode" localize="false" id="pyc_id361620324544381">FSO = CreateScriptService("FileSystem")</paragraph>
+ <paragraph role="pycode" localize="false" id="pyc_id161620324434583">myDoc2 = svcUI.CreateDocument(templatefile = FSO.BuildPath(FSO.TemplatesFolder, "personal/CV.ott"))</paragraph>
+ </pycode>
+</section>
- <section id="GetDocument">
+<section id="GetDocument">
<comment> GetDocument -------------------------------------------------------------------------------------------------------------------------- </comment>
<bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id351588520551838">
<bookmark_value>UI service;GetDocument</bookmark_value>
</bookmark>
<h2 id="hd_id171588520551515" localize="false">GetDocument</h2>
<paragraph role="paragraph" id="par_id201588520551463">Returns a document object referring to either the active window or the given window.</paragraph>
- <h3 id="hd_id931588520551562" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functsyntax"/></h3>
- <bascode>
- <paragraph role="bascode" localize="false" id="bas_id591588520551793">ui.GetDocument([WindowName As String]) As Object</paragraph>
- </bascode>
- <h3 id="hd_id1001588520551269" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functparameters"/></h3>
- <paragraph role="paragraph" id="par_id851588520551368"><emph>WindowName</emph>: see the definitions above.</paragraph>
- <h3 id="hd_id421588520551206" 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_id811620320778478">
+ <input>svc.GetDocument(windowname: str = ''): svc</input>
+ </paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functparameters"/>
+ <paragraph role="paragraph" id="par_id851588520551368"><emph>windowname</emph>: See the definitions <link href="text/sbasic/shared/03/sf_ui.xhp#WindowName" name="WindowName section">above</link>. If this argument is absent, the active window is used.</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_id191588522924110">Dim myDoc As Object</paragraph>
- <paragraph role="bascode" localize="false" id="bas_id591588520551682">Set myDoc = ui.GetDocument("C:\Me\My file.odt")</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id591588520551682">Set myDoc = ui.GetDocument("C:\Documents\My file.odt")</paragraph>
</bascode>
- </section>
+ <embed href="text/sbasic/shared/00000003.xhp#In_Python"/>
+ <pycode>
+ <paragraph role="pycode" localize="false" id="pyc_id831620330074037">myDoc = svcUI.GetDocument(r"C:\Documents\My file.odt")</paragraph>
+ </pycode>
+ <tip id="par_id521620330287071">To access the name of the currently active window, refer to the <literal>ActiveWindow</literal> property.</tip>
+</section>
- <section id="Maximize">
+<section id="Maximize">
<comment> Maximize -------------------------------------------------------------------------------------------------------------------------- </comment>
<bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id441587986441397">
<bookmark_value>UI service;Maximize</bookmark_value>
</bookmark>
<h2 id="hd_id261587986441738" localize="false">Maximize</h2>
<paragraph role="paragraph" id="par_id24158798644169">Maximizes the active window or the given window.</paragraph>
- <h3 id="hd_id921587986441522" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functsyntax"/></h3>
- <bascode>
- <paragraph role="bascode" localize="false" id="bas_id141587986441257">ui.Maximize([WindowName As String])</paragraph>
- </bascode>
- <h3 id="hd_id621587986441611" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functparameters"/></h3>
- <paragraph role="paragraph" id="par_id951587986441954"><emph>WindowName</emph>: see the definitions above. If the argument is absent, the active window is maximized.</paragraph>
- <h3 id="hd_id471587986441580" 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_id631620320925633">
+ <input>svc.Maximize(windowname: str)</input>
+ </paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functparameters"/>
+ <paragraph role="paragraph" id="par_id951587986441954"><emph>windowname</emph>: see the definitions <link href="text/sbasic/shared/03/sf_ui.xhp#WindowName" name="WindowName section">above</link>. If this argument is absent, the active window is maximized.</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_id891587986441319">ui.Maximize("Untitled 1")</paragraph>
</bascode>
- </section>
+ <embed href="text/sbasic/shared/00000003.xhp#In_Python"/>
+ <pycode>
+ <paragraph role="pycode" localize="false" id="pyc_id181620330373220">svcUI.Maximize("Untitled 1")</paragraph>
+ </pycode>
+</section>
- <section id="Minimize">
+<section id="Minimize">
<comment> Minimize -------------------------------------------------------------------------------------------------------------------------- </comment>
<bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id2315879865929">
<bookmark_value>UI service;Minimize</bookmark_value>
</bookmark>
<h2 id="hd_id21158798659210" localize="false">Minimize</h2>
<paragraph role="paragraph" id="par_id871587986592696">Minimizes the active window or the given window.</paragraph>
- <h3 id="hd_id621587986592339" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functsyntax"/></h3>
+ <embed href="text/sbasic/shared/00000003.xhp#functsyntax"/>
+ <paragraph role="paragraph" localize="false" id="par_id201620321224368">
+ <input>svc.Minimize(windowname: str)</input>
+ </paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functparameters"/>
+ <paragraph role="paragraph" id="par_id751587986592626"><emph>windowname</emph>: see the definitions <link href="text/sbasic/shared/03/sf_ui.xhp#WindowName" name="WindowName section">above</link>. If this argument is absent, the active window is minimized.</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_id321587986592534">ui.Minimize([WindowName As String])</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id671587986592107">ui.Minimize()</paragraph>
</bascode>
- <h3 id="hd_id971587986592623" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functparameters"/></h3>
- <paragraph role="paragraph" id="par_id751587986592626"><emph>WindowName</emph>: see the definitions above. If the argument is absent, the active window is minimized.</paragraph>
- <h3 id="hd_id381587986592563" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functexample"/></h3>
- <bascode>
- <paragraph role="bascode" localize="false" id="bas_id671587986592107">ui.Minimize()</paragraph>
- </bascode>
- </section>
+ <embed href="text/sbasic/shared/00000003.xhp#In_Python"/>
+ <pycode>
+ <paragraph role="pycode" localize="false" id="pyc_id481620330501644">svcUI.Minimize()</paragraph>
+ </pycode>
+</section>
- <section id="OpenBaseDocument">
+<section id="OpenBaseDocument">
<comment> OpenBaseDocument -------------------------------------------------------------------------------------------------------------------------- </comment>
<bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id291596555746452">
<bookmark_value>UI service;OpenBaseDocument</bookmark_value>
</bookmark>
<h2 id="hd_id671596555746148" localize="false">OpenBaseDocument</h2>
- <paragraph role="paragraph" id="par_id691596555746539">Open an existing LibreOffice Base document. The method returns a document object.</paragraph>
- <h3 id="hd_id121596555746296" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functsyntax"/></h3>
- <bascode>
- <paragraph role="bascode" localize="false" id="bas_id831596555746349">ui.OpenBaseDocument([FileName As String], [RegistrationName As String], [MacroExecution As Integer]) As Object</paragraph>
- </bascode>
- <h3 id="hd_id651596555746823" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functparameters"/></h3>
- <paragraph role="paragraph" id="par_id231596555746385"><emph>FileName</emph> : Identifies the file to open. It must follow the SF_FileSystem.FileNaming notation. If the file already exists, it is overwritten without warning</paragraph>
- <paragraph role="paragraph" id="par_id711596555746281" xml-lang="en-US"><emph>RegistrationName</emph> : The name to use to find the database in the databases register. It is ignored if <literal>FileName</literal> &lt;&gt; "".</paragraph>
- <paragraph role="paragraph" id="id721596556313545" xml-lang="en-US"><emph>MacroExecution</emph>: 0 = behaviour is defined by the user configuration, 1 = macros are not executable, 2 = macros are executable.</paragraph>
- <h3 id="hd_id601596555746980" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functexample"/></h3>
+ <paragraph role="paragraph" id="par_id691596555746539">Open an existing %PRODUCTNAME Base document. The method returns a document object.</paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functsyntax"/>
+ <paragraph role="paragraph" localize="false" id="par_id21620321395150">
+ <input>svc.OpenBaseDocument(filename: str = '', registrationname: str = '', macroexecution: int = 0): svc</input>
+ </paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functparameters"/>
+ <paragraph role="paragraph" id="par_id231596555746385"><emph>filename</emph> : Identifies the file to open. It must follow the SF_FileSystem.FileNaming notation. If the file already exists, it is overwritten without warning</paragraph>
+ <paragraph role="paragraph" id="par_id711596555746281" xml-lang="en-US"><emph>registrationname</emph> : The name to use to find the database in the databases register. It is ignored if <literal>FileName</literal> &lt;&gt; "".</paragraph>
+ <paragraph role="paragraph" id="id721596556313545" xml-lang="en-US"><emph>macroexecution</emph>: 0 = behaviour is defined by the user configuration, 1 = macros are not executable, 2 = macros are executable.</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_id761596555746795">Dim myBase As Object</paragraph>
- <paragraph role="bascode" localize="false" id="bas_id91596555746449">Set myBase = ui.OpenBaseDocument("C:\Temp\myDB.odb", MacroExecution := 2)</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id91596555746449">Set myBase = ui.OpenBaseDocument("C:\Documents\myDB.odb", MacroExecution := ui.MACROEXECALWAYS)</paragraph>
</bascode>
- </section>
+ <embed href="text/sbasic/shared/00000003.xhp#In_Python"/>
+ <pycode>
+ <paragraph role="pycode" localize="false" id="pyc_id431620331254271">svcUI.OpenBaseDocument(r"C:\Documents\myDB.odb", macroexecution = svcUI.MACROEXECALWAYS)</paragraph>
+ </pycode>
+ <tip id="par_id941620762989833">To improve code readability you can use <link href="text/sbasic/shared/03/sf_ui.xhp#Constants" name="CHANGE ME">predefined constants</link> for the <literal>macroexecution</literal> argument, as in the examples above.</tip>
+</section>
- <section id="OpenDocument">
+<section id="OpenDocument">
<comment> OpenDocument -------------------------------------------------------------------------------------------------------------------------- </comment>
<bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id141588523635836">
<bookmark_value>UI service;OpenDocument</bookmark_value>
</bookmark>
<h2 id="hd_id451588523635719" localize="false">OpenDocument (*)</h2>
- <paragraph role="paragraph" id="par_id541588523635283">Open an existing LibreOffice document with the given options. Returns a document object or one of its subclasses or <literal>Null</literal> if the opening failed, including when due to a user decision.</paragraph>
- <h3 id="hd_id111588523635204" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functsyntax"/></h3>
- <bascode>
- <paragraph role="bascode" localize="false" id="bas_id221588523635225">ui.OpenDocument(FileName As String, [Password As String], [ReadOnly As Boolean], _</paragraph>
- <paragraph role="bascode" localize="false" id="bas_id391588524030857">[Hidden As Boolean], [MacroExecution As Integer], [FilterName As String], [FilterOptions As String]) As Object</paragraph>
- </bascode>
- <h3 id="hd_id421588523635830" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functparameters"/></h3>
- <paragraph role="paragraph" id="par_id481588523635890"><emph>FileName</emph>: Identifies the file to open. It must follow the <literal>FileNaming</literal> notation of the <literal>FileSystem</literal> service.</paragraph>
- <paragraph role="paragraph" id="par_id451588523635507" xml-lang="en-US"><emph>Password</emph>: To use when the document is protected. If wrong or absent while the document is protected, the user will be prompted to enter a password.</paragraph>
- <paragraph role="paragraph" id="par_id611588524329781" xml-lang="en-US"><emph>ReadOnly</emph>: Default = <literal>False</literal>.</paragraph>
- <paragraph role="paragraph" id="par_id641588523635497" xml-lang="en-US"><emph>Hidden</emph>: if <literal>True</literal>, open the new document in the background (default = False). To use with caution: activation or closure afterwards can only happen programmatically.</paragraph>
- <paragraph role="paragraph" id="par_id981588524474719" xml-lang="en-US"><emph>MacroExecution</emph>: 0 = behaviour is defined by the user configuration, 1 = macros are not executable, 2 = macros are executable.</paragraph>
- <paragraph role="paragraph" id="par_id611588524584693" xml-lang="en-US"><emph>FilterName</emph>: The name of a filter that should be used for loading the document. If present, the filter must exist.</paragraph>
- <paragraph role="paragraph" id="par_id191588524634348" xml-lang="en-US"><emph>FilterOptions</emph>: An optional string of options associated with the filter.</paragraph>
- <h3 id="hd_id151588523635407" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functexample"/></h3>
+ <paragraph role="paragraph" id="par_id541588523635283">Opens an existing %PRODUCTNAME document with the given options. Returns a document object or one of its subclasses. The method returns <literal>Nothing</literal> (in Basic) / <literal>None</literal> (in Python) if the opening failed, even when the failure is caused by a user decision.</paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functsyntax"/>
+ <paragraph role="paragraph" localize="false" id="par_id271620321692960">
+ <input>svc.Opendocument(filename: str, password: str = '', readonly: bool = False, hidden: bool = False, macroexecution: int = 0, filtername: str = '', filteroptions: str = ''): svc</input>
+ </paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functparameters"/>
+ <paragraph role="paragraph" id="par_id481588523635890"><emph>filename</emph>: Identifies the file to open. It must follow the <literal>FileNaming</literal> notation of the <literal>FileSystem</literal> service.</paragraph>
+ <paragraph role="paragraph" id="par_id451588523635507" xml-lang="en-US"><emph>password</emph>: To use when the document is protected. If wrong or absent while the document is protected, the user will be prompted to enter a password.</paragraph>
+ <paragraph role="paragraph" id="par_id611588524329781" xml-lang="en-US"><emph>readonly</emph>: Default = <literal>False</literal>.</paragraph>
+ <paragraph role="paragraph" id="par_id641588523635497" xml-lang="en-US"><emph>hidden</emph>: if <literal>True</literal>, open the new document in the background (default = <literal>False</literal>). To use with caution: activation or closure afterwards can only happen programmatically.</paragraph>
+ <paragraph role="paragraph" id="par_id981588524474719" xml-lang="en-US"><emph>macroexecution</emph>: 0 = behaviour is defined by the user configuration, 1 = macros are not executable, 2 = macros are executable.</paragraph>
+ <paragraph role="paragraph" id="par_id611588524584693" xml-lang="en-US"><emph>filtername</emph>: The name of a filter that should be used for loading the document. If present, the filter must exist.</paragraph>
+ <paragraph role="paragraph" id="par_id191588524634348" xml-lang="en-US"><emph>filteroptions</emph>: An optional string of options associated with the filter.</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_id811588523635720">Dim myDoc As Object, FSO As Object</paragraph>
- <paragraph role="bascode" localize="false" id="bas_id391588523635826">Set myDoc = ui.OpenDocument("C:\Temp\myFile.odt", MacroExecution := 1)</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id391588523635826">Set myDoc = ui.OpenDocument("C:\Documents\myFile.odt", ReadOnly := True)</paragraph>
</bascode>
- </section>
+ <embed href="text/sbasic/shared/00000003.xhp#In_Python"/>
+ <pycode>
+ <paragraph role="pycode" localize="false" id="pyc_id891620331804571">svcUI.OpenDocument(r"C:\Documents\myFile.odt", readonly = True)</paragraph>
+ </pycode>
+</section>
- <section id="Resize">
+<section id="Resize">
<comment> Resize -------------------------------------------------------------------------------------------------------------------------- </comment>
<bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id951587986945259">
<bookmark_value>UI service;Resize</bookmark_value>
</bookmark>
<h2 id="hd_id551587986945514" localize="false">Resize</h2>
<paragraph role="paragraph" id="par_id751587986945965">Resizes and/or moves the active window. Absent and negative arguments are ignored. If the window is minimized or maximized, calling <literal>Resize</literal> without arguments restores it.</paragraph>
- <h3 id="hd_id861587986945481" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functsyntax"/></h3>
- <bascode>
- <paragraph role="bascode" localize="false" id="bas_id9315879869453">ui.Resize([Left As Long], [Top As Long], [Width As Long], [Height As Long])</paragraph>
- </bascode>
- <h3 id="hd_id821587986945735" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functparameters"/></h3>
- <paragraph role="paragraph" id="par_id441587986945696"><emph>Left, Top</emph>: Distances of the top-left corner from top and left edges of the screen.</paragraph>
- <paragraph role="paragraph" id="par_id601587987453825" xml-lang="en-US"><emph>Width, Height</emph>: New dimensions of the window.</paragraph>
- <h3 id="hd_id251587986945699" 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_id411620321819387">
+ <input>svc.Resize(left: int = -1, top: int = -1, width: int = -1, height: int = -1)</input>
+ </paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functparameters"/>
+ <paragraph role="paragraph" id="par_id441587986945696"><emph>left, top</emph>: Distances of the top-left corner from top and left edges of the screen, in pixels.</paragraph>
+ <paragraph role="paragraph" id="par_id601587987453825" xml-lang="en-US"><emph>width, height</emph>: New dimensions of the window, in pixels.</paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functexample"/>
+ <paragraph role="paragraph" id="par_id801587987507028">In the following examples, the <literal>widht</literal> and <literal>height</literal> of the window are changed while <literal>top</literal> and <literal>left</literal> are left unchanged.</paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#In_Basic"/>
<bascode>
- <paragraph role="bascode" localize="false" id="bas_id171587986945392">ui.Resize(10,,500)</paragraph>
- <paragraph role="bascode" id="bas_id801587987507028">' Top and Height are left unchanged</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id171587986945392">ui.Resize(, ,500, 500)</paragraph>
</bascode>
- </section>
+ <embed href="text/sbasic/shared/00000003.xhp#In_Python"/>
+ <pycode>
+ <paragraph role="pycode" id="pyc_id971620331945744">svcUI.Resize(width = 500, height = 500)</paragraph>
+ </pycode>
+ <tip id="par_id21620332301809">To resize a window that is not active, first activate it using the <literal>Activate</literal> method.</tip>
+</section>
- <section id="SetStatusBar">
+<section id="SetStatusBar">
<comment> SetStatusbar -------------------------------------------------------------------------------------------------------------------------- </comment>
<bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id25158799642119">
<bookmark_value>UI service;SetStatusbar</bookmark_value>
</bookmark>
<h2 id="hd_id171587996421550" localize="false">SetStatusbar (*)</h2>
<paragraph role="paragraph" id="par_id281587996421580">Display a text and a progressbar in the status bar of the active window. Any subsequent calls in the same macro run refer to the same status bar of the same window, even if the window is not visible anymore. A call without arguments resets the status bar to its normal state.</paragraph>
- <h3 id="hd_id61587996421735" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functsyntax"/></h3>
- <bascode>
- <paragraph role="bascode" localize="false" id="bas_id561587996421155">ui.SetStatusbar([Text As String], [Percentage As Integer])</paragraph>
- </bascode>
- <h3 id="hd_id771587996421217" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functparameters"/></h3>
- <paragraph role="paragraph" id="par_id71587996421829"><emph>Text</emph>: An optional text to be displayed in front of the progress bar.</paragraph>
- <paragraph role="paragraph" id="par_id881587996421777" xml-lang="en-US"><emph>Percentage</emph>: an optional degree of progress between 0 and 100.</paragraph>
- <h3 id="hd_id841587996421626" 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_id461620321923929">
+ <input>svc.SetStatusbar(text: str = '', percentage: int = -1)</input>
+ </paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functparameters"/>
+ <paragraph role="paragraph" id="par_id71587996421829"><emph>text</emph>: An optional text to be displayed in front of the progress bar.</paragraph>
+ <paragraph role="paragraph" id="par_id881587996421777" xml-lang="en-US"><emph>percentage</emph>: an optional degree of progress between 0 and 100.</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_id61587996791867">Dim i As Integer</paragraph>
<paragraph role="bascode" localize="false" id="bas_id291587996799353">For i = 0 To 100</paragraph>
<paragraph role="bascode" localize="false" id="bas_id331587996806267"> ui.SetStatusbar("Progress ...", i)</paragraph>
<paragraph role="bascode" localize="false" id="bas_id491587996813628"> Wait 50</paragraph>
<paragraph role="bascode" localize="false" id="bas_id841587996820714">Next i</paragraph>
+ <paragraph role="bascode" id="bas_id651620332601083">' Resets the statusbar</paragraph>
<paragraph role="bascode" localize="false" id="bas_id141587996829242">ui.SetStatusbar</paragraph>
</bascode>
- </section>
+ <embed href="text/sbasic/shared/00000003.xhp#In_Python"/>
+ <pycode>
+ <paragraph role="pycode" id="pyc_id631620332653004">from time import sleep</paragraph>
+ <paragraph role="pycode" id="pyc_id351620332422330">for i in range(101):</paragraph>
+ <paragraph role="bascode" id="bas_id261620332627647"> svcUI.SetStatusbar("Test:", i)</paragraph>
+ <paragraph role="pycode" id="pyc_id181620332715974"> sleep(0.05)</paragraph>
+ <paragraph role="pycode" id="pyc_id381620332733373">svcUI.SetStatusbar()</paragraph>
+ </pycode>
+</section>
- <section id="ShowProgressBar">
+<section id="ShowProgressBar">
<comment> ShowProgressBar -------------------------------------------------------------------------------------------------------------------------- </comment>
<bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id91159886425573">
<bookmark_value>UI service;ShowProgressBar</bookmark_value>
</bookmark>
<h2 id="hd_id31598864255380" localize="false">ShowProgressBar</h2>
<paragraph role="paragraph" id="par_id571598864255776">Display a non-modal dialog box. Specify its title, an explicatory text and a percentage of progress represented on a progressbar. The box will remain visible until a call to the method without argument, or until the end of the currently running macro.</paragraph>
- <h3 id="hd_id31598864255246" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functsyntax"/></h3>
- <bascode>
- <paragraph role="bascode" localize="false" id="bas_id491598864255836">ui.ShowProgressBar([Title As String], [Text As String], [Percentage As Integer])</paragraph>
- </bascode>
- <h3 id="hd_id171598864255620" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functparameters"/></h3>
- <paragraph role="paragraph" id="par_id441598864535695" xml-lang="en-US"><emph>Title</emph> : The title appearing on top of the dialog box. Default = "ScriptForge".</paragraph>
- <paragraph role="paragraph" id="par_id311598864255297"><emph>Text</emph>: An optional text to be displayed above the progress bar.</paragraph>
- <paragraph role="paragraph" id="par_id881598864255424" xml-lang="en-US"><emph>Percentage</emph>: an optional degree of progress between 0 and 100.</paragraph>
- <h3 id="hd_id49159886425584" 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_id41620322016943">
+ <input>svc.ShowProgressBar(title: str = '', text: str = '', percentage: str = -1)</input>
+ </paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functparameters"/>
+ <paragraph role="paragraph" id="par_id441598864535695" xml-lang="en-US"><emph>title</emph> : The title appearing on top of the dialog box. Default = "ScriptForge".</paragraph>
+ <paragraph role="paragraph" id="par_id311598864255297"><emph>text</emph>: An optional text to be displayed above the progress bar.</paragraph>
+ <paragraph role="paragraph" id="par_id881598864255424" xml-lang="en-US"><emph>percentage</emph>: an optional degree of progress between 0 and 100.</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_id931598864255666">Dim i As Integer</paragraph>
<paragraph role="bascode" localize="false" id="bas_id211598864255731">For i = 0 To 100</paragraph>
- <paragraph role="bascode" localize="false" id="bas_id341598864255351"> ui.ShowProgressBar(, "Progress ..." &amp; i &amp; "/100", i)</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id341598864255351"> ui.ShowProgressBar("Window Title", "Progress ..." &amp; i &amp; "/100", i)</paragraph>
<paragraph role="bascode" localize="false" id="bas_id34159886425576"> Wait 50</paragraph>
<paragraph role="bascode" localize="false" id="bas_id541598864255593">Next i</paragraph>
+ <paragraph role="bascode" id="bas_id651620333289753">' Closes the Progress Bar window</paragraph>
<paragraph role="bascode" localize="false" id="bas_id21598864255428">ui.ShowProgressBar</paragraph>
</bascode>
- </section>
+ <embed href="text/sbasic/shared/00000003.xhp#In_Python"/>
+ <pycode>
+ <paragraph role="pycode" localize="false" id="pyc_id821620333264948">from time import sleep</paragraph>
+ <paragraph role="pycode" localize="false" id="pyc_id611620333268146">for i in range(101):</paragraph>
+ <paragraph role="pycode" localize="false" id="pyc_id331620333268525"> svcUI.ShowProgressBar("Window Title", "Progress ... " + str(i) + "/100", i)</paragraph>
+ <paragraph role="pycode" localize="false" id="pyc_id451620333268900"> sleep(0.05)</paragraph>
+ <paragraph role="pycode" id="pyc_id761620333269236"># Closes the Progress Bar window</paragraph>
+ <paragraph role="pycode" localize="false" id="pyc_id81620333269484">svcUI.ShowProgressBar()</paragraph>
+ </pycode>
+</section>
- <section id="WindowExists">
+<section id="WindowExists">
<comment> WindowExists -------------------------------------------------------------------------------------------------------------------------- </comment>
<bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id431588587119136">
<bookmark_value>UI service;WindowExists</bookmark_value>
</bookmark>
<h2 id="hd_id21588587119344" localize="false">WindowExists</h2>
<paragraph role="paragraph" id="par_id431588587119925">Returns <literal>True</literal> if the given window could be identified.</paragraph>
- <h3 id="hd_id61588587119150" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functsyntax"/></h3>
- <bascode>
- <paragraph role="bascode" localize="false" id="bas_id811588587119559">ui.WindowExists(WindowName As String) As Boolean</paragraph>
- </bascode>
- <h3 id="hd_id761588587119371" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functparameters"/></h3>
- <paragraph role="paragraph" id="par_id45158858711917"><emph>WindowName</emph>: see the definitions above.</paragraph>
- <h3 id="hd_id651588587119757" 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_id521620322090015">
+ <input>svc.WindowExists(windowname: str): bool</input>
+ </paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functparameters"/>
+ <paragraph role="paragraph" id="par_id45158858711917"><emph>windowname</emph>: see the definitions above.</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_id941588587119772">If ui.WindowExists("C:\Me\My file.odt") Then</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id941588587119772">If ui.WindowExists("C:\Document\My file.odt") Then</paragraph>
<paragraph role="bascode" localize="false" id="bas_id871588587295216"> ' ...</paragraph>
</bascode>
- </section>
+ <embed href="text/sbasic/shared/00000003.xhp#In_Python"/>
+ <pycode>
+ <paragraph role="pycode" id="pyc_id441620333481074">if svcUI.WindowExists(r"C:\Document\My file.odt"):</paragraph>
+ <paragraph role="pycode" id="pyc_id801620333495532"> # ...</paragraph>
+ </pycode>
+</section>
+<section id="relatedtopics">
+ <embed href="text/sbasic/shared/03/sf_document.xhp#DocumentService"/>
+</section>
</body>
</helpdocument>