FileButton

Previous Next

 

A push button in a dialog window that allows the user to select a file from the file system. When the user presses the button, a Browse window appears that shows the folder hierarchy of the computer's file system.

 

Example

In this example:

file specifies a default filepath. When the Browse window is opened, the directory of this filepath is selected, so that the user can select a file from it, or navigate to a different directory.

resultTo specifies that the file selected in the Browse window is passed to a text box in the dialog.

resultFrom specifies that if the text box already contains a file path, this path must be used as the default filepath when the user enters the Browse window.

<example xmlns:pc="Processing.Command" xmlns:assign="Processing.Command.Assign" pc:hideme="true">
 
<pc:assign-var-default
   somefile = "{path:Combine(directories:Get( ),'myfile.xml')}" />
 
<pc:Dialog 
   assign:proceed="/Forms/Form/@result='OK'"
   assign:file = "/Forms/Form/TextBox[1]/text()">
   <Form>
      <Title>Specify a file</Title>
      <Label dx="5" dy="5" w="30">File:</Label>
      <TextBox w="400" name="filebox"><pc:value-of select="$somefile"/></TextBox>
      <FileButton 
         dx="10" w="90" h="20" file="{$somefile}"
         resultTo="filebox" resultFrom="filebox">File...</FileButton>   
      <Button dy="20" newline="true"><Result>OK</Result>Proceed</Button>
      <Button><Result>Cancel</Result>Cancel</Button>
   </Form>
</pc:Dialog>
   
<pc:if test="xslutil:test($proceed)">
   <pc:then>Ok: <pc:value-of select="$file"/></pc:then>
   <pc:else>Cancelled</pc:else>
</pc:if>
</example>

 

 

See also

pc:Dialog