Thread: [Wnd-commit] wnd/wnd_doc/doc/controls/dialog classes/replacetext .CVSIGNORE,NONE,1.1 replacetext.dtp
Status: Alpha
Brought to you by:
jurner
|
From: jürgen u. <cer...@us...> - 2005-07-23 20:07:07
|
Update of /cvsroot/wnd/wnd/wnd_doc/doc/controls/dialog classes/replacetext In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6257 Added Files: .CVSIGNORE replacetext.dtpl Log Message: bit of this and a bit of that --- NEW FILE: .CVSIGNORE --- *.html *.gif --- NEW FILE: replacetext.dtpl --- ::defaultpage:: ReplaceText ::site:: ReplaceText <IMG SRC="ReplaceText.gif"></IMG> <br><br> <a HREF="contents.html">ReplaceText contents</a> <br><br> ::site:: class ReplaceText <code class=import>defined in: wnd.dlgs.openfile</code><br><br> <code>ReplaceText(*flags)</code><br> Creates an modeless replace text dialogbox. <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> <br><br> <b>NOTE</b><br> Due to the fact that the ReplaceText dialog is a nodeless dialogbox you have to create its parent window with the 'dialoglike' style set to enable keyboard support for the dialog. <P> ::site:: class ReplaceTextFromTemplate <code class=import>defined in: wnd.dlgs.openfile</code><br><br> <code>ReplaceTextFromTemplate(template, *flags)</code><br> Inits a replace text 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> <br><br> <b>NOTE</b><br> Due to the fact that the ReplaceText dialog is a nodeless dialogbox you have to create its parent window with the 'dialoglike' style set to enable keyboard support for the dialog. <P> ::site:: class ReplaceTextFromInstance <code class=import>defined in: wnd.dlgs.choosefont</code><br><br> <code>ReplaceTextFromInstance(instance, templatename, *flags)</code><br> <P> Inits a replace text 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> <br><br> <b>NOTE</b><br> Due to the fact that the ReplaceText dialog is a nodeless dialogbox you have to create its parent window with the 'dialoglike' style set to enable keyboard support for the dialog. <P> ::site:: ReplaceText messages A ReplaceText dialog the following messages to the message handler:<br><br> <DL> <DT>'fr_findnext' <DD>the user has cklicked the 'find' button<br> wp=tuple(text to find, text-to-replace-with)<br> lp=flags <br><br> 'flags' is a list containing none one or more of the following flags: <br> <TABLE class="table1" BORDER="1"> <TR> <TD>'matchcase'</TD> <TD>the search should be case sensitive. If 'matchcase' is not in lisr seach should be performed case insensitive</TD> </TR> <TR> <TD>'wholeword'</TD> <TD>the search should match whole word only. If 'wholeword' is not in list the search should be performed matching any occurences chars specified</TD> </TR> </TABLE> <br><br> <DT>'fr_replace' <DD>the user has cklicked the 'replace' button<br> wp=tuple(text to find, text-to-replace-with)<br> lp=flags <br><br> 'flags' is a list containing none one or more of the flags as defined for the 'fr_findtext' message <br> <br><br> <DT>'fr_replaceall' <DD>the user has cklicked the 'replace all' button<br> wp=tuple(text to find, text-to-replace-with)<br> lp=flags <br><br> 'flags' is a list containing none one or more of the flags as defined for the 'fr_findtext' message <br> <br><br> <DT>'fr_buffererror' <DD>Send if the buffer intended to hold the string the user specified as search string is not large enough to hold all the chars<br> wp='find' or 'replace', according to the buffer affected<br> lp=tuple(required-buffer-size, actual-buffer-size) <br><br> Its up to you how to react on receiving this messaqge. One way is call <a HREF="ReplaceText methods/SetBufferSize.html">SetBufferSize</a> and adjust the buffer. After doing so you will receive the 'fr_ReplaceText' message with the correct number of chars. You may aswell return False here to cancel the 'fr_ReplaceText' message, or process the 'fr_ReplaceText' message with the truncated number of chars. <br><br> </DL> ::folder:: ReplaceText methods ReplaceText instances support all dialog methods except RunModal and RunModeless. (no link currently available) plus the following methods: ::item:: Run <code>Run(hwnd, what, *flags, **kwargs)</code><br> <P> Runs the ReplaceText dialog <DL> <DT>hwnd <DD>hwnd of the parent window. You have to specify a valid hwnd, otherwise the dialog can not be created <br><br> <DT>what <DD>the searchstring you want to initialize the dialogbox with. Can be '' (empty string) <br><br> <DT>*flags <DD>One or more of the following flags: <br> <TABLE class="table1" BORDER="1"> <TR> <TD>'hidematchcase'</TD> <TD>hides the match case checkbox</TD> </TR> <TR> <TD>'nowholeword'</TD> <TD>disables the the whole word checkbox</TD> </TR> <TR> <TD>'nomatchcase'</TD> <TD>disables the match case checkbox</TD> </TR> <TR> <TD>'hidewholeword'</TD> <TD>hides the the whole word checkbox</TD> </TR> <TR> <TD>'hook'</TD> <TD>hooks the dialog, so you can process messages like for any othe rdialog</TD> </TR> <TR> <TD>'showhelp'</TD> <TD>shows the help button</TD> </TR> </TABLE> <DT>kwargs <DD>The following keyword arguments are recognised: <TABLE class="table1" BORDER="1"> <TR> <TD>'buffersize'</TD> <TD>the size of the buffer containing the search and the size buffer dor the replace stringstring.</TD> </TR> <br><br> <b>Return value</b><br> The hwnd of the dialogbox if it coulg sucefully created </P> ::item:: SetBufferSize <code>SetBufferSize(n)</code><br> <P>Sets the size of the buffer used to hold the find string and the size for the buffer holding the replacement string <br><br> This method works only if the dialog is actually running <br><br> <b>Return value</b><br> True on successs, False otherwise </P> ::item:: CheckWholeWord <code>CheckWholeWord()</code><br> <P>Checks the whole word checkbox <br><br> This method works only if the dialog is actually running <br><br> <b>Return value</b><br> True on successs, False otherwise </P> ::item:: isWholeWordChecked <code>isWholeWordChecked()</code><br> <P>Returns True if the whole word checkbox is checked, False otherwise <br><br> This method works only if the dialog is actually running </P> ::item:: CheckMatchCase <code>CheckMatchCase()</code><br> <P>Checks the match case checkbox <br><br> This method works only if the dialog is actually running <br><br> <b>Return value</b><br> True on successs, False otherwise </P> ::item:: IsMatchCaseChecked <code>IsMatchCaseChecked()</code><br> <P>Returns True if the match case checkbox is checked, False otherwise <br><br> This method works only if the dialog is actually running </P> ::site:: customizing ReplaceText There are two ways to customize the ReplaceText 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/replacetext.py'</I> for a default template of the dialogbox <LI> </OL> The ReplaceText 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>'Replace'</TD> <TD>36, 44, 230, 94</TD> <TD>WS_BORDER | WS_CAPTION | DS_MODALFRAME | WS_POPUP | WS_SYSMENU | DS_3DLOOK | DS_CONTEXTHELP</TD> </TR> <TR> <TD>'static'</TD> <TD>0xFFFFFFFF</TD> <TD>'Fi&nd what:'</TD> <TD>4, 9, 48, 8</TD> <TD>SS_LEFT | WS_VISIBLE</TD> </TR> <TR> <TD>'edit'</TD> <TD>edt1</TD> <TD>''</TD> <TD>54, 7, 114, 12</TD> <TD>WS_GROUP | WS_TABSTOP | ES_AUTOHSCROLL | WS_VISIBLE | WS_EX_CLIENTEDGE</TD> </TR> <TR> <TD>'static'</TD> <TD>0xFFFFFFFF</TD> <TD>'Re&place with:'</TD> <TD>4, 26, 48, 8</TD> <TD>SS_LEFT | WS_VISIBLE</TD> </TR> <TR> <TD>'edit'</TD> <TD>edt2</TD> <TD>''</TD> <TD>454, 24, 114, 12</TD> <TD>WS_GROUP | WS_TABSTOP | ES_AUTOHSCROLL | WS_VISIBLE | WS_EX_CLIENTEDGE</TD> </TR> <TR> <TD>'button'</TD> <TD>chx1</TD> <TD>'Match &whole word only'</TD> <TD>5, 46, 104, 12</TD> <TD>WS_GROUP | BS_AUTOCHECKBOX | WS_VISIBLE | WS_TABSTOP</TD> </TR> <TR> <TD>'button'</TD> <TD>chx1</TD> <TD>'Match &case'</TD> <TD>5, 46, 104, 12</TD> <TD>BS_AUTOCHECKBOX | WS_VISIBLE</TD> </TR> <TR> <TD>'button'</TD> <TD>IDOK</TD> <TD>'&Find Next'</TD> <TD>174, 4, 50, 14</TD> <TD>WS_GROUP | WS_VISIBLE | WS_TABSTOP</TD> </TR> <TR> <TD>'button'</TD> <TD>psh1</TD> <TD>'&Replace'</TD> <TD>182, 5, 50, 14</TD> <TD>WS_VISIBLE</TD> </TR> <TR> <TD>'button'</TD> <TD>psh2</TD> <TD>'Replace &All'</TD> <TD>174, 38, 50, 14</TD> <TD>WS_VISIBLE</TD> </TR> <TR> <TD>'button'</TD> <TD>'Cancel'</TD> <TD>IDCANCEL</TD> <TD>174, 55, 50, 14</TD> <TD>WS_VISIBLE</TD> </TR> <TR> <TD>'button'</TD> <TD>pshHelp</TD> <TD>'&Help'</TD> <TD>174, 75, 50, 14</TD> <TD>WS_VISIBLE</TD> </TR> </TABLE> |