Stringscan

Check-in [b5b1f268c0]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Refine selection of files in listbox
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: b5b1f268c084da4fb52ce4b447d788249065a6f772cfb387b653766a8559a829
User & Date: kevin 2017-06-12 03:39:40
Context
2017-06-20
03:10
Update stringscan.rb check-in: f0321c7428 user: kevin tags: trunk
2017-06-12
03:39
Refine selection of files in listbox check-in: b5b1f268c0 user: kevin tags: trunk
2017-06-11
04:52
More polish check-in: 21d76d7da6 user: kevin tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to stringscan.rb.

144
145
146
147
148
149
150





151
152
153
154
155
156
157
158
159
160
161
162











163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
      style 'TablelistHeader.TLabel'
      padding 1
    }.pack('side'=>'top', 'fill'=>'both', 'expand' => 'no')
    $lbox = Tk::Listbox.new($bottomleftframe){
      width 50
      height 30
      borderwidth 0





      dnd_bindtarget('text/uri-list', '<Drop>', '%D') {|d|
        filename=d.join(' ')
                               begin
                                 if File.directory?(filename)
                                   $dirname = filename
                                   $direntry.value = filename
                                 end
                               rescue
                                 raise
                               end
        }
    }.pack('side'=>'left','fill' => 'both', 'expand' => 'yes')











    $scrollframe = Tk::Frame.new($bottomleftframe).pack('side'=>'right','fill' => 'y', 'expand' => 'no')
    $listscroll = Tk::Scrollbar.new($scrollframe).pack('side'=>'right','fill' => 'y', 'expand' => 'no')
    $lbox.yscrollbar($listscroll)
    $bottomrightframe  =Tk::Tile::Frame.new($bottomframe).pack('side'=>'right','fill' => 'both', 'expand' => 'yes')
    $tbox = Tk::Text::new($bottomrightframe){
      borderwidth 0.1
      relief 'sunken'
      wrap 'word'
      highlightcolor 'SlateGray3'
      bg 'white'
      state 'disabled'
    }.pack('side'=>'left','fill' => 'both', 'expand' => 'yes')
    $tscrollframe = Tk::Frame.new($bottomrightframe).pack('side'=>'right','fill' => 'y', 'expand' => 'no')
    $tscroll = Tk::Scrollbar.new($tscrollframe).pack('side'=>'right','fill' => 'y', 'expand' => 'no')
    $tbox.yscrollbar($tscroll)
    $lbox.bind '<ListboxSelect>', proc {
      begin
      if $lbox.curselection.empty?
        return
      else
        highlighttext TkSelection.get
      end
      rescue
        raise
      end
    }
  end

  #read file for display in text widget
  def highlighttext(file)
   $tbox.configure('state'=>'normal')
   $tbox.delete('1.0', 'end') 
   f = open(file, 'rb')
    while(!f.eof?)







>
>
>
>
>












>
>
>
>
>
>
>
>
>
>
>















<
<
<
<
<
<
|
<
<
<
|
<







144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193






194



195

196
197
198
199
200
201
202
      style 'TablelistHeader.TLabel'
      padding 1
    }.pack('side'=>'top', 'fill'=>'both', 'expand' => 'no')
    $lbox = Tk::Listbox.new($bottomleftframe){
      width 50
      height 30
      borderwidth 0
      takefocus 0
      activestyle "none"
      exportselection 0
      selectbackground "RoyalBlue1"
      selectforeground "white"
      dnd_bindtarget('text/uri-list', '<Drop>', '%D') {|d|
        filename=d.join(' ')
                               begin
                                 if File.directory?(filename)
                                   $dirname = filename
                                   $direntry.value = filename
                                 end
                               rescue
                                 raise
                               end
        }
    }.pack('side'=>'left','fill' => 'both', 'expand' => 'yes')
    $lbox.bind '<ListboxSelect>', proc {
       begin
      if $lbox.curselection.empty?
       puts "No selection in listbox."
      else
         highlighttext  $lbox.get($lbox.curselection[0])
      end
      rescue
        puts "Cannot get selection in listbox."
      end
     }
    $scrollframe = Tk::Frame.new($bottomleftframe).pack('side'=>'right','fill' => 'y', 'expand' => 'no')
    $listscroll = Tk::Scrollbar.new($scrollframe).pack('side'=>'right','fill' => 'y', 'expand' => 'no')
    $lbox.yscrollbar($listscroll)
    $bottomrightframe  =Tk::Tile::Frame.new($bottomframe).pack('side'=>'right','fill' => 'both', 'expand' => 'yes')
    $tbox = Tk::Text::new($bottomrightframe){
      borderwidth 0.1
      relief 'sunken'
      wrap 'word'
      highlightcolor 'SlateGray3'
      bg 'white'
      state 'disabled'
    }.pack('side'=>'left','fill' => 'both', 'expand' => 'yes')
    $tscrollframe = Tk::Frame.new($bottomrightframe).pack('side'=>'right','fill' => 'y', 'expand' => 'no')
    $tscroll = Tk::Scrollbar.new($tscrollframe).pack('side'=>'right','fill' => 'y', 'expand' => 'no')
    $tbox.yscrollbar($tscroll)






  end






  #read file for display in text widget
  def highlighttext(file)
   $tbox.configure('state'=>'normal')
   $tbox.delete('1.0', 'end') 
   f = open(file, 'rb')
    while(!f.eof?)