Class: FindFrame

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(_parent) ⇒ FindFrame

Returns a new instance of FindFrame.



186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
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
# File 'ext/ae-search-in-files/ae-search-in-files.rb', line 186

def initialize(_parent)
  super(_parent)
  y0 = 10
  d = 23    
  TkLabel.new(self.frame){
    text 'Find what:'
 	  place('x' => 8,'y' => y0,'height' => 19)
  }
  y0 = y0 + d
  @e_what = Tk::BWidget::ComboBox.new(self.frame){
    editable true
    justify  'left'
    relief  'ridge'
    autocomplete 'true'
    entrybg '#FFFFFF'
    expand 'tab'
    takefocus 'true'
    place('relwidth' => 1, 'width'=>-16,'x' => 8,'y' => y0,'height' => 19)
  }
  @e_what_entry = TkWinfo.children(@e_what)[0]
  y0 = y0 + d
  TkLabel.new(self.frame){
 	  text 'Files filter:'
 	  place('x' => 8,'y' => y0,'height' => 19)
  }
  y0 = y0 + d
 
  @e_filter = Tk::BWidget::ComboBox.new(self.frame){
    editable true
    justify  'left'
    relief  'ridge'
    autocomplete 'true'
    #insertbackground '#FFFFFF'
    entrybg '#FFFFFF'
    expand 'tab'
    takefocus 'true'
    #pack('padx'=>10, 'fill'=>'x')
    place('relwidth' => 1, 'width'=>-16,'x' => 8,'y' => y0,'height' => 19)
  }
  @e_filter.text('*.rb')
  y0 = y0 + d

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

  _h_frame = TkFrame.new(self.frame).place('relwidth' => 1, 'width'=>-16,'x' => 8,'y' => y0,'height' => 19)
  @e_dir = Tk::BWidget::ComboBox.new(_h_frame){
    editable true
    justify  'left'
    relief  'ridge'
    autocomplete 'true'
    #insertbackground '#FFFFFF'
    entrybg '#FFFFFF'
    expand 'tab'
    takefocus 'true'
    #pack('side'=>'left','fill'=>'x')
    pack('fill'=>'x')
    #place('relwidth' => 1, 'width'=>-16,'x' => 8,'y' => y0,'height' => 19)
  }
  @e_dir.text(Dir.pwd)
  @b_dir = TkButton.new(_h_frame){
    compound  'none'
    default  'disabled'
    text  '...'
    overrelief  'raised'
    justify  'center'
    pack('side'=>'right','ipadx'=>5, 'padx'=>5)
  }.bind('1', proc{
    _d = Tk.chooseDirectory('initialdir'=>@e_dir.text,'mustexist'=>true)
    if _d && _d.strip.length > 0
      @e_dir.text(_d)
    end
  })
  
  y0 = y0 + d
  y0 = y0 + d
  @buttons_frame = TkFrame.new(self.frame).pack('fill'=>'x', 'side'=>'bottom')	

  @b_go = TkButton.new(@buttons_frame){|_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.



185
186
187
# File 'ext/ae-search-in-files/ae-search-in-files.rb', line 185

def b_go
  @b_go
end

#e_dirObject (readonly)

Returns the value of attribute e_dir.



184
185
186
# File 'ext/ae-search-in-files/ae-search-in-files.rb', line 184

def e_dir
  @e_dir
end

#e_filterObject (readonly)

Returns the value of attribute e_filter.



183
184
185
# File 'ext/ae-search-in-files/ae-search-in-files.rb', line 183

def e_filter
  @e_filter
end

#e_whatObject (readonly)

Returns the value of attribute e_what.



181
182
183
# File 'ext/ae-search-in-files/ae-search-in-files.rb', line 181

def e_what
  @e_what
end

#e_what_entryObject (readonly)

Returns the value of attribute e_what_entry.



182
183
184
# File 'ext/ae-search-in-files/ae-search-in-files.rb', line 182

def e_what_entry
  @e_what_entry
end

Instance Method Details

#showObject



278
279
280
281
282
283
# File 'ext/ae-search-in-files/ae-search-in-files.rb', line 278

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