Thread: [Wnd-commit] wnd/wnd_doc/doc/controls/dialog classes/opensavefile .CVSIGNORE,NONE,1.1 opensavefile.d
Status: Alpha
Brought to you by:
jurner
|
From: jürgen u. <cer...@us...> - 2005-07-23 20:06:15
|
Update of /cvsroot/wnd/wnd/wnd_doc/doc/controls/dialog classes/opensavefile In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6025 Added Files: .CVSIGNORE opensavefile.dtpl Log Message: bit of this and a bit of that --- NEW FILE: opensavefile.dtpl --- ::defaultpage:: OpenSaveFile ::site:: OpenSaveFile <IMG SRC="opensavefile.gif"></IMG> <br><br> <a HREF="contents.html">OpenSaveFile contents</a> <br><br> ::site:: class OpenSaveFile <code class=import>defined in: wnd.dlgs.openfile</code><br><br> <code>OpenSaveFile(*flags)</code><br> Creates an open or save file dialog. <br><br> <br> flags can be a combination of the following flags: flags can be a combination of the following flags: <DL> <DT>'debug' <DD>if the dialog is hooked this will allow for debugging its messages. The message handler will be called with a message 'debug' <br> lp= the message ID<br> wp= formated message as string <br><br> <DT>'debugall' <DD>same as 'debug' but prints out more messages <br><br> </DL> <P> ::site:: class OpenSaveFileFromTemplate <code class=import>defined in: wnd.dlgs.openfile</code><br><br> <code>OpenSaveFileFromTemplate(template, *flags)</code><br> Inits a OpenSaveFile dialog class from a custom template. <br><br> Template should be a string containing the raw bytes of the template to create the dialog from. <br> flags can be a combination of the following flags: flags can be a combination of the following flags: <DL> <DT>'debug' <DD>if the dialog is hooked this will allow for debugging its messages. The message handler will be called with a message 'debug' <br> lp= the message ID<br> wp= formated message as string <br><br> <DT>'debugall' <DD>same as 'debug' but prints out more messages <br><br> </DL> <P> ::site:: class OpenSaveFileFromInstance <code class=import>defined in: wnd.dlgs.choosefont</code><br><br> <code>OpenSaveFileFromInstance(instance, templatename, *flags)</code><br> <P> Inits a OpenSaveFile dialog class from a custom template in a dll. <br><br> instance should be the handle to a dll containing the template or a sll loaded with ctypes. templatename its resource identifier. <br><br> <b>Note</b><br> <b>(!!) This class is currently not tested, so please report any missbehaviour.</b> <br><br> flags can be a combination of the following flags: <DL> <DT>'debug' <DD>if the dialog is hooked this will allow for debugging its messages. The message handler will be called with a message 'debug' <br> lp= the message ID<br> wp= formated message as string <br><br> <DT>'debugall' <DD>same as 'debug' but prints out more messages <br><br> </DL> <P> ::site:: customizing OpenSaveFile There are two ways to customize the OpenSaveFile dialog: <P> <OL> <LI>by hooking it <LI>by passing a custom dialog template to it (with or without hooking) </OL> </P> <H3>hooking</H3> This will subclass the dialog. You can process all messages like for any other dialog. Create controls in response to the onINIT handler play around with the default controls or whatever. <br><br> The rules are like this. If you return 0 from a message handler the systems dialog proc will process the message as usual, if you return 1 it will not. <H3>custom template</H3> You can pass a custom template to the dialog, to be used as template for the dialog. The following table shows the controls the standard dialog hosts. <br><br> In 'wnd/dlgs/templates/openfile.py' you will find the default template for the OpenSaveFile dialog. You can use this template to base your customized template upon. <br><br> <b>Notes</b><br> <OL> <LI>The ids for the controls you will find in <code class=import>wnd.consts.dlgs</code> <LI>the classname for the main-form should not be specifyed in the template <LI>before you start massive typing work, see <i>'wnd/dlgs/templates/opensavefile.py'</I> for a default template of the dialogbox <LI> </OL> The OpenSaveFile dialog contains the following controls: <TABLE class="table1" BORDER="1"> <TH colspan=4>default font used is: 8 (size)</TH> <TR> <TD><b>classname</b></TD> <TD><b>id</b></TD> <TD><b>title</b></TD> <TD><b>size</b></TD> <TD><b>style</b></TD> </TR> <TR> <TD>'MS Shell Dlg' (mainform)</TD> <TD>-</TD> <TD>'Open'</TD> <TD>0, 0, 280, 164</TD> <TD>DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | DS_CONTEXTHELP | WS_CLIPCHILDREN</TD> </TR> <TR> <TD>'static'</TD> <TD>stc4</TD> <TD>'Look &in:'</TD> <TD>7, 6, 27, 8</TD> <TD>SS_LEFT | SS_NOTIFY | WS_VISIBLE</TD> </TR> <TR> <TD>'combobox'</TD> <TD>-</TD> <TD>cmb2</TD> <TD>36, 3, 138, 300</TD> <TD>CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP | WS_VISIBLE</TD> </TR> <TR> <TD>'static'</TD> <TD></TD> <TD>stc1</TD> <TD>172, 2, 102, 17</TD> <TD></TD> </TR> <TR> <TD>'listbox'</TD> <TD>lst1</TD> <TD>-</TD> <TD>4, 20, 272, 85</TD> <TD> LBS_SORT | LBS_NOINTEGRALHEIGHT | LBS_MULTICOLUMN | WS_HSCROLL</TD> </TR> <TR> <TD>'static'</TD> <TD>stc3</TD> <TD>'File &name:'</TD> <TD>5, 112, 48, 8</TD> <TD>SS_NOTIFY | WS_VISIBLE</TD> </TR> <TR> <TD>'edit'</TD> <TD>edt1</TD> <TD>-</TD> <TD>54, 111, 155, 12</TD> <TD>ES_AUTOHSCROLL | WS_VISIBLE</TD> </TR> <TR> <TD>'static'</TD> <TD>stc2</TD> <TD>'File &type:'</TD> <TD>5, 131, 48, 8</TD> <TD>SS_NOTIFY | WS_VISIBLE</TD> </TR> <TR> <TD>'combobox'</TD> <TD>cmb1</TD> <TD>-</TD> <TD>54, 129, 155, 100</TD> <TD>CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP |WS_VISIBLE</TD> </TR> <TR> <TD>'button'</TD> <TD>chx1</TD> <TD>'Open as &read-only'</TD> <TD>54, 148, 74, 10</TD> <TD>WS_TABSTOP | BS_AUTOCHECKBOX | WS_VISIBLE</TD> </TR> <TR> <TD>'button'</TD> <TD>IDOK</TD> <TD>'&Open'</TD> <TD>222, 110, 50, 14</TD> <TD>BS_DEFPUSHBUTTON | WS_VISIBLE | WS_TABSTOP</TD> </TR> <TR> <TD>'button'</TD> <TD>IDCANCEL</TD> <TD>'Cancel'</TD> <TD>222, 128, 50, 14</TD> <TD>WS_VISIBLE</TD> </TR> <TR> <TD>'button'</TD> <TD>pshHelp</TD> <TD>'&Help'</TD> <TD>222, 145, 50, 14</TD> <TD>WS_VISIBLE</TD> </TR> </TABLE> ::folder:: OpenSaveFile methods OpenSaveFile instances support all dialog methods except RunModal and RunModeless. (no link currently available) plus the following methods: ::item:: SaveFile <code>SaveFile(hwnd, *flags, **kwargs)</code><br> <P>Runs the dialog to return the path of a file to save to. <br><br> For the parameters to this method see <a HREF="OpenFile.html">OpenFile</a> <br><br> <b>Return value</b><br> None if the user canceled th edialog, The full path to a file to save to otherwise </P> ::item:: OpenFile <code>OpenFile(hwnd, *flags, **kwargs)</code><br> <P>Runs the dialog to return the path of one or more files to open <DL> <DT>hwnd <DD>hwnd of the parent window or None <br><br> <DT>*flags <DD>If the dialog is hooked the view flags as defined in <a HREF="SetView.html">SetView</a> are recognized.<br> In any case you can pass one or more of the following flags: <br> <TABLE class="table1" BORDER="1"> <TR> <TD>'allowmultiselect'</TD> <TD>allows the user to select multiple files.</TD> </TR> <TR> <TD>'createpropmt'</TD> <TD>prompts the user for permission before creating the file if the filename he typed in does not exist</TD> </TR> <TR> <TD>'dontaddtorecent'</TD> <TD>Let me guess here. The file chosen is not added to recent docs</TD> </TR> <TR> <TD>'filemustexist'</TD> <TD>throws a messagebox if the file the user typed in does not exist</TD> </TR> <TR> <TD>'hidereadonly'</TD> <TD>hides the readonly box</TD> </TR> <TR> <TD>'hook'</TD> <TD>rhooks the dialog. This is usefull for further customizing the dialog. See <a HREF="../customizing Openfile.html">customizing OpenSaveFile</a>. If the dialog is not hooked any attempt to call any dialog methods for the dialog will fail. </TD> </TR> <TR> <TD>'nochangedir'</TD> <TD>restores the current working directory if the user changed it while searching for as file</TD> </TR> <TR> <TD>'nodereferencelinks'</TD> <TD>if the user chooses a link (*.LNK) with this flag set the path of the link is returnd, without the path of the file pointed to by the link</TD> </TR> <TR> <TD>'nonetworkbutton'</TD> <TD>hides the network button</TD> </TR> <TR> <TD>'novalidate'</TD> <TD>allows the user to type in chars not allowed in filenames</TD> </TR> <TR> <TD>'noreadonlyreturn'</TD> <TD>does not allow the user to choose read only files</TD> </TR> <TR> <TD>'overwriteprompt'</TD> <TD>prompts the user for permission if the file already exists (SaveFile)</TD> </TR> <TR> <TD>'pathmustexist'</TD> <TD>throws an error if the path the user typed in does not exist</TD> </TR> <TR> <TD>'readonly'</TD> <TD>checks the readonly box</TD> </TR> <TR> <TD>'shareaware'</TD> <TD>ignores network sharing violations</TD> </TR> <TR> <TD>'showhelp'</TD> <TD>shows the 'Help' button</TD> </TR> </TABLE> <br><br> <DT>kwargs <DD>The following keyword arguments are recognised: <TABLE class="table1" BORDER="1"> <TR> <TD>'buffersize'</TD> <TD>the size of the return buffer for the file(s) selected. Default is OFN_FILEBUFFERSIZE chars.</TD> </TR> <TR> <TD>'defext'</TD> <TD>the default extension to add to the file if the user does not specify one. <br><br> According to windows standards the extension may be three chars long (no period) </TD> </TR> <TR> <TD>'deffile'</TD> <TD>the suggested default file to open</TD> </TR> <TR> <TD>'deffilter'</TD> <TD>the one based index of the filter to apply</TD> </TR> <TR> <TD>'filters'</TD> <TD>the filters the user may choose from <br><br> deffilter should be a string of '\x00' sparated filters, double '\x00' terminated. <b>'Python (py)\x00*.py\x00Text (txt)\x00*.txt\x00\x00'</b> will result in the following filters to be displayed: <br> Python (py)<br> Text (txt) <br><br> A filter consists of a '\x00' separeted pair, filter-name, filter-pattern. To use more then one pattern for the same filter-name separate the patterns by semicolon: <b>'Python (py, pyc, pyo)\x00*.py;*.pyc;*.pyo'</b> (no spaces allowed in the pattern part) <br><br> This open file implemenation uses 'All Files (*.*)\x00*.*\x00\x00' by default. You may clear this by specifying '' (empty string) as filter. </TD> </TR> <TR> <TD>'initialdir'</TD> <TD>path of the initial directory</TD> </TR> <TR> <TD>'title'</TD> <TD>Overwrites the default title of the open file dialogbox</TD> </TR> </TABLE> <DT> <DD> </DL> <br><br> <b>Return value</b><br> <P> If the user canceled the dialog, return value is always None. <br><br> If the dialog is run with the 'allowmultiselect' flag set return value is a list of files chosen by the user. If one file was selected the first member of the list is the complete filepath of the file chosen. If multiple files where selected the first member of the list is the directory path, followed by the filenames of the files selected <br><br> If the dialog was run without the 'allowmultiselect' flag set, return value is the filepath of the file selected. </P> </P> ::item:: IsReadonlyChecked <code>IsReadonlyChecked()</code><br> <P>Returns true if the readonly checkbox was checked the last time the dialog was run, False otherwise. <br><br> Use this to determine the state of the checkbox emidiately after the dialog was run. If the user canceled the dialog, return value is always False </P> ::item:: GetBufferError <code>GetBufferError()</code><br> <P>If something goes wrong with the dialog, an exception is raised. For the special case that the buffer used to return the filenames is to small you can use this method to check for the required buffersize. <br><br> This value is always updated the next time the dialog is run. <br><br> <b>Return value</b><br> Zero if no buffer error was encountered, the count in bytes of the buffer required to return the files the user selected otherwise <br><br> <b>Note</b><br> Dono wether this is usefull or not. But as long as the user does not select even more files the next time the dialog is run it may be worth while giving him or her or it a second chance. </P> ::item:: SetView <code>SetView(view)</code><br> <P>Changes the view for the dialog <br><br> You can use this method if the dialog is hooked, to set the view for the listview displaying the files and folders. 'view' can be': <br> <TABLE class="table1" BORDER="1"> <TR> <TD>'largeicon'</TD> <TD>causes the listview to display large icons</TD> </TR> <TR> <TD>list'</TD> <TD>causes the listview to display the items as list</TD> </TR> <TR> <TD>'report'</TD> <TD>causes the listview to display the items in report view (showing details)</TD> </TR> <TR> <TD>'smallicon'</TD> <TD>causes the listview to display small icons</TD> </TR> <TR> <TD>'thumbnails'</TD> <TD>??</TD> </TR> </TABLE> </P> --- NEW FILE: .CVSIGNORE --- *.html *.gif |