TIP #243: SUPPLY FIND DIALOG FOR THE TEXT WIDGET ================================================== Version: $Revision: 1.3 $ Author: Rüdiger Härtel State: Draft Type: Project Tcl-Version: 8.7 Vote: Pending Created: Wednesday, 16 March 2005 URL: https://tip.tcl-lang.org243.html Post-History: ------------------------------------------------------------------------- ABSTRACT ========== This TIP adds a /find dialog/ to the Tk *text* widget. RATIONALE =========== In using the *text* widget it often is a desire to search the input, and the text widget itself provides already all means to search text. However, until now there is no GUI based support, so each application developer needing it has to reinvent much of this particular wheel. Tk should provide a scripted find dialog in its library scripts so that simple applications can be built more easily and to a higher quality. Additionally, a /replace dialog/ is desirable, and it should be developed at the same time. REFERENCE IMPLEMENTATION ========================== A reference implementation for a /find dialog/ is available at []. EXAMPLE USE ============= package require Tk namespace import ::msgcat::* mclocale en ::msgcat::mcset en LblSearchString "Search String" ::msgcat::mcset en LblDirection "Direction" ::msgcat::mcset en ChkBtnFindCaseOpt "Case" ::msgcat::mcset en ChkBtnFindRegexpOpt "Regexp" ::msgcat::mcset en RdoBtnFindDirOpt1 "Forward" ::msgcat::mcset en RdoBtnFindDirOpt2 "Backward" ::msgcat::mcset en BtnFind " Find " ::msgcat::mcset en BtnFindNext " Next " ::msgcat::mcset en BtnClose " Close " set b1 .button set t1 .t1 button $b1 -text Find -command [list \ tk_textFind $t1 -searchstring hallo -highlightcolor green \ -title "Find Dialog"] text $t1 grid $b1 -row 0 -column 1 grid $t1 -row 1 -column 0 -columnspan 2 set fd [open [file join . tk_find.tcl] r] set content [read $fd] close $fd $t1 insert 0.0 $content set content "" COPYRIGHT =========== This document is in the public domain. ------------------------------------------------------------------------- TIP AutoGenerator - written by Donal K. Fellows