Class: FindFrame

Inherits:
TkFloatTitledFrame show all
Defined in:
ext/ae-search-in-files/ae-search-in-files.rb

Constant Summary

Constants included from TkResizable

TkResizable::MIN_HEIGHT, TkResizable::MIN_WIDTH

Instance Attribute Summary collapse

Attributes inherited from TkBaseTitledFrame

#frame, #top

Instance Method Summary collapse

Methods inherited from TkFloatTitledFrame

#head_buttons, #hide, #on_close=, #show_grabbed, #title

Methods included from TkResizable

#resizing_do_move_obj, #resizing_do_press, #start_resizing, #stop_resizing

Methods included from TkMovable

#moving_do_move_obj, #moving_do_press, #start_moving, #stop_moving

Methods inherited from TkBaseTitledFrame

#add_fixed_button, #add_fixed_menu_button, #add_fixed_sep, #create_frame, #head_buttons, #menu_button, #visible?

Constructor Details

#initialize(_parent) ⇒ FindFrame

Returns a new instance of FindFrame.



233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
# File 'ext/ae-search-in-files/ae-search-in-files.rb', line 233

def initialize(_parent)
  super(_parent)
  y0 = 10
  d = 23    
  TkLabel.new(self.frame, Arcadia.style('label')){
    text 'Find what:'
 	  place('x' => 8,'y' => y0,'height' => 19)
  }
  y0 = y0 + d
  @e_what = Tk::BWidget::ComboBox.new(self.frame, Arcadia.style('combobox')){
    editable true
    justify  'left'
    autocomplete 'true'
    expand 'tab'
    takefocus 'true'
    place('relwidth' => 1, 'width'=>-16,'x' => 8,'y' => y0,'height' => 19)
  }
  @e_what_entry = TkWinfo.children(@e_what)[0]
  # this means "after each key press 
  @e_what_entry.bind_append("1",proc{Arcadia.process_event(InputEnterEvent.new(self,'receiver'=>@e_what_entry))})
  
  y0 = y0 + d
  TkLabel.new(self.frame, Arcadia.style('label')){
 	  text 'Files filter:'
 	  place('x' => 8,'y' => y0,'height' => 19)
  }
  y0 = y0 + d
 
  @e_filter = Tk::BWidget::ComboBox.new(self.frame, Arcadia.style('combobox')){
    editable true
    justify  'left'
    autocomplete 'true'
    expand 'tab'
    takefocus 'true'
          #pack('padx'=>10, 'fill'=>'x')
    place('relwidth' => 1, 'width'=>-16,'x' => 8,'y' => y0,'height' => 19)
  }
  @e_filter_entry = TkWinfo.children(@e_filter)[0]
  @e_filter_entry.bind_append("1",proc{Arcadia.process_event(InputEnterEvent.new(self,'receiver'=>@e_filter_entry))})

  @e_filter.insert('end', '*.*')
  @e_filter.insert('end', '*.rb')
  @e_filter.text('*.rb')
  y0 = y0 + d

  TkLabel.new(self.frame, Arcadia.style('label')){
 	  text 'Directory:'
 	  place('x' => 8,'y' => y0,'height' => 19)
  }
  y0 = y0 + d

  _h_frame = TkFrame.new(self.frame, Arcadia.style('panel')).place('relwidth' => 1, 'width'=>-16,'x' => 8,'y' => y0,'height' => 19)
  @e_dir = Tk::BWidget::ComboBox.new(_h_frame, Arcadia.style('combobox')){
    editable true
    justify  'left'
    autocomplete 'true'
    expand 'tab'
    takefocus 'true'
    pack('fill'=>'x')
    #pack('fill'=>'x')
    #place('relwidth' => 1, 'width'=>-16,'x' => 8,'y' => y0,'height' => 19)
  }
  @e_dir.text(MonitorLastUsedDir.get_last_dir)
  @e_dir_entry = TkWinfo.children(@e_dir)[0]

  @b_dir = TkButton.new(@e_dir, Arcadia.style('button') ){
    compound  'none'
    default  'disabled'
    text  '...'
    pack('side'=>'right')
    #pack('side'=>'right','ipadx'=>5, 'padx'=>5)
  }.bind('1', proc{
       change_dir
       Tk.callback_break
  })
  
  y0 = y0 + d
  y0 = y0 + d
  @buttons_frame = TkFrame.new(self.frame, Arcadia.style('panel')).pack('fill'=>'x', 'side'=>'bottom')	

  @b_go = TkButton.new(@buttons_frame, Arcadia.style('button')){|_b_go|
    compound  'none'
    default  'disabled'
    text  'Find'
    #overrelief  'raised'
    #justify  'center'
    pack('side'=>'right','ipadx'=>5, 'padx'=>5)
  }
  place('x'=>100,'y'=>100,'height'=> 220,'width'=> 300)
end

Instance Attribute Details

#b_goObject (readonly)

Returns the value of attribute b_go.



232
233
234
# File 'ext/ae-search-in-files/ae-search-in-files.rb', line 232

def b_go
  @b_go
end

#e_dirObject (readonly)

Returns the value of attribute e_dir.



230
231
232
# File 'ext/ae-search-in-files/ae-search-in-files.rb', line 230

def e_dir
  @e_dir
end

#e_dir_entryObject (readonly)

Returns the value of attribute e_dir_entry.



231
232
233
# File 'ext/ae-search-in-files/ae-search-in-files.rb', line 231

def e_dir_entry
  @e_dir_entry
end

#e_filterObject (readonly)

Returns the value of attribute e_filter.



230
231
232
# File 'ext/ae-search-in-files/ae-search-in-files.rb', line 230

def e_filter
  @e_filter
end

#e_filter_entryObject (readonly)

Returns the value of attribute e_filter_entry.



231
232
233
# File 'ext/ae-search-in-files/ae-search-in-files.rb', line 231

def e_filter_entry
  @e_filter_entry
end

#e_whatObject (readonly)

Returns the value of attribute e_what.



230
231
232
# File 'ext/ae-search-in-files/ae-search-in-files.rb', line 230

def e_what
  @e_what
end

#e_what_entryObject (readonly)

Returns the value of attribute e_what_entry.



231
232
233
# File 'ext/ae-search-in-files/ae-search-in-files.rb', line 231

def e_what_entry
  @e_what_entry
end

Instance Method Details

#change_dirObject



324
325
326
327
328
329
# File 'ext/ae-search-in-files/ae-search-in-files.rb', line 324

def change_dir
  _d = Tk.chooseDirectory('initialdir'=>@e_dir.text,'mustexist'=>true)
  if _d && _d.strip.length > 0
    @e_dir.text(_d)
  end
end

#showObject



331
332
333
334
335
336
# File 'ext/ae-search-in-files/ae-search-in-files.rb', line 331

def show
  super
  self.focus
  @e_what.focus
  @e_what_entry.selection_range(0,'end')
end