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, #hide_if_visible, #on_arcadia, #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_panel, #add_fixed_progress, #add_fixed_sep, #create_frame, #head_buttons, #menu_button, #visible?

Constructor Details

#initialize(_parent) ⇒ FindFrame

Returns a new instance of FindFrame.



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
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
# File 'ext/ae-search-in-files/ae-search-in-files.rb', line 247

def initialize(_parent)
  super(_parent)
  y0 = 10
  d = 23    
  TkLabel.new(self.frame, Arcadia.style('label')){
    text Arcadia.text('ext.search_in_files.search.label.find_what')
 	  place('x' => 8,'y' => y0,'height' => 19)
  }
  y0 = y0 + d
  #@e_what = Tk::BWidget::ComboBox.new(self.frame, Arcadia.style('combobox')){
  @e_what = Arcadia.wf.combobox(self.frame){
    #editable true
    justify  'left'
    #autocomplete 'true'
    #expand 'tab'
    exportselection true
    width 100
    takefocus 'true'
    place('relwidth' => 1, 'width'=>-16,'x' => 8,'y' => y0,'height' => 19)
  }
  
  @e_what.extend(TkInputThrow)


#    @e_what_entry = TkWinfo.children(@e_what)[0]
#    # this means "after each key press 
#    @e_what_entry.extend(TkInputThrow)
  
  y0 = y0 + d
  TkLabel.new(self.frame, Arcadia.style('label')){
 	  text Arcadia.text('ext.search_in_files.search.label.files_filter')
 	  place('x' => 8,'y' => y0,'height' => 19)
  }
  y0 = y0 + d
 
  #@e_filter = Tk::BWidget::ComboBox.new(self.frame, Arcadia.style('combobox')){
  @e_filter = Arcadia.wf.combobox(self.frame){
    #editable true
    justify  'left'
    #autocomplete 'true'
    #expand 'tab'
    exportselection true
    width 100
    takefocus 'true'
    place('relwidth' => 1, 'width'=>-16,'x' => 8,'y' => y0,'height' => 19)
  }
  @e_filter.extend(TkInputThrow)

#    @e_filter_entry = TkWinfo.children(@e_filter)[0]
#    @e_filter_entry.extend(TkInputThrow)

  @e_filter.values = ['*.rb', '*.*']
  @e_filter.value = @e_filter.values[0]
#    @e_filter.insert('end', '*.*')
#    @e_filter.insert('end', '*.rb')
#    @e_filter.text('*.rb')

  y0 = y0 + d

  TkLabel.new(self.frame, Arcadia.style('label')){
 	  text Arcadia.text('ext.search_in_files.search.label.dir')
 	  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')){
  @e_dir = Arcadia.wf.combobox(_h_frame){
    #editable true
    justify  'left'
    #autocomplete 'true'
    #expand 'tab'
    exportselection true
    width 100
    takefocus 'true'
    pack('fill'=>'x')
    #pack('fill'=>'x')
    #place('relwidth' => 1, 'width'=>-16,'x' => 8,'y' => y0,'height' => 19)
  }
  @e_dir.value = MonitorLastUsedDir.get_last_dir

#    @e_dir.text(MonitorLastUsedDir.get_last_dir)
#    @e_dir_entry = TkWinfo.children(@e_dir)[0]

  #@b_dir = TkButton.new(@e_dir, Arcadia.style('button') ){
  @b_dir = Arcadia.wf.button(@e_dir){
    compound  'none'
    default  'disabled'
    text  '...'
    width 3
    pack('side'=>'right', 'padx'=>18)
    #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|
  @b_go = Arcadia.wf.button(@buttons_frame){|_b_go|
    compound  'none'
    default  'disabled'
    text  Arcadia.text('ext.search_in_files.search.button.find')
    #overrelief  'raised'
    #justify  'center'
    pack('side'=>'right','ipadx'=>5, 'padx'=>5)
  }
  place('x'=>100,'y'=>100,'height'=> 220,'width'=> 350)
end

Instance Attribute Details

#b_goObject (readonly)

attr_reader :e_what_entry, :e_filter_entry, :e_dir_entry



246
247
248
# File 'ext/ae-search-in-files/ae-search-in-files.rb', line 246

def b_go
  @b_go
end

#e_dirObject (readonly)

Returns the value of attribute e_dir.



244
245
246
# File 'ext/ae-search-in-files/ae-search-in-files.rb', line 244

def e_dir
  @e_dir
end

#e_filterObject (readonly)

Returns the value of attribute e_filter.



244
245
246
# File 'ext/ae-search-in-files/ae-search-in-files.rb', line 244

def e_filter
  @e_filter
end

#e_whatObject (readonly)

Returns the value of attribute e_what.



244
245
246
# File 'ext/ae-search-in-files/ae-search-in-files.rb', line 244

def e_what
  @e_what
end

Instance Method Details

#change_dirObject



361
362
363
364
365
366
367
368
369
370
371
372
# File 'ext/ae-search-in-files/ae-search-in-files.rb', line 361

def change_dir
  #_d = Tk.chooseDirectory('initialdir'=>@e_dir.text,'mustexist'=>true)
  _d = Arcadia.select_dir_dialog(@e_dir.value, true)
  if _d && _d.strip.length > 0
    @e_dir.value = _d
    values = @e_dir.values
    if (values != nil && !values.include?(_d))
       values << _d
       @e_dir.values=values
    end      
  end
end

#showObject



374
375
376
377
378
379
380
381
382
# File 'ext/ae-search-in-files/ae-search-in-files.rb', line 374

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